How to parseForm?

cancel
Showing results for 
Search instead for 
Did you mean: 
amruta_w
Senior Member

How to parseForm?

Hello,

I have created the process with three task. In ADF i'm trying to parse the form like 

this.formService.getTaskForm(this.currentTaskId).subscribe(
data => {
for(let i = 0; i < data.fields.length ; i++) {
this.fields2 = data.fields[i].fields;
let count = 0;
count = Object.keys(this.fields2).length;
for ( let j= 1; j <= count ; j++) {
let fields3 = this.fields2[j];
for (let k=0 ; k<fields3.length ; k++) {
this.customData.push(fields3[k]);
}
}
}
this.form = this.formService.parseForm(this.customData);

after parsing my page looks like 

I have referred the following documentation

https://github.com/Alfresco/alfresco-ng2-components/blob/master/docs/core/form.component.md 

I want to update the fields information, so I tried doing this.

Please anyone help me to resolve this.

Thanks & Regards

Amruta Wandakar

3 Replies
roberto_gamiz
Established Member II

Re: How to parseForm?

Hello,

Here you can see an example of the definition you need to use to parse a form from a json:

alfresco-ng2-components/demo-form.json at development · Alfresco/alfresco-ng2-components · GitHub 

alfresco-ng2-components/form-definition.model.ts at development · Alfresco/alfresco-ng2-components ·...  

Anyway, ¿is your workflow deployed on APS/Activity 7 or in ACS?.  FormService only works with APS workflows.

Regards

amruta_w
Senior Member

Re: How to parseForm?

Thanks i just found the above link one hour ago, i'm trying to update the field definitions in the form, for example if field.type == readonly make that field as text, like field.type = text. Do you have any idea regarding this.

Thanks & Regards

Amruta W

roberto_gamiz
Established Member II

Re: How to parseForm?

Hello,

I usually use custom classes to implement my form definition model . You could pass in the constructor the info you have and from that apply the necesary logic to generate the structure you need to parse the form

Of course, you can implement methods to update the fields once the definition is generated but i never have found a situation that required it.

Regards