Hello
How can I transfer data between forms in a process?
In other words how the output data of a form can be used as input data in another form?
Thanks
Hi,
First, store the output data from the first form in process variables. You can do it in the “Operations” panel of the human task (in the studio).
Then, you can retrieve the process variables from the second form. Here are the steps to follow in UI Designer :
-
First you have to figure out the id of the current activity :
- Create a new variable of type External API. Call it task
- Enter the following url : …/API/bpm/humanTask/{{taskId}} (taskId is a variable which is automatically created when generating the form from the studio)
- The caseId is now available using task.rootCaseId
-
Now, you can get the process variables from the REST API :
- Create a variable of type External API. I’ll call it myVariable
- Enter the following url : …/API/bpm/caseVariable/{{task.rootCaseId}}/[name of the process variable]
- Note that the value is not stored directly into myVariable but in a property called value. So, if you want to display the variable in a text widget (or anywhere else) you have to use myVariable.value
Regards
Hi,
The first form take the output in a BDM object ( you configure the BDM objet in Contract ). Previously you had created a BDM object.
Later, if you use another form in another process, you build an another form wiht data you want ( Contract ). Then, you edit the new form, and for example, you want to see a text field charged previosly on your BDM object ( first form ) .
Steps:
Create a process var ( “nameOfYourProcessVar” ) in “Data / process vars / commerce vars” with your BDM object.
Edit it to charge it ( edit and pencil icon ). Something like that:
NameOfYourBDMObject newObject = new NameOfYourBDMObject ();
newObject.setFieldName(nameOfYourProcessVarContract.get(“FieldName”));
return newObject;
In UI Design, put a Text Field.
At Value write “nameOfYourProcessVar.FieldName” ( the value you want to see and was loaded at first form ).
Create a var ( in UI Designer ) with “nameOfYourProcessVar.FieldName”, “External API” and with the value “…/{{context.nameOfYourProcessVar_ref.link}}” ( this, take the value of the BDM object ).
Try to execute and if everything is ok, you will see the value of “FieldName” of your BDM object at the second form.
Thank you Quentin
I performed the above steps but unfortunately was not successful.
Actually I am confused. For example how can I store the data to process variable?
I will be very grateful if you explain your answer a little bit more…
Thanks in advance
From the studio, select the pool and go to data panel. Here you can create, delete and modify variables. You can use either BDM object or a process variable. The choice will mainly depend on the kind of data you need to store
Hi,
I think you want store a value of UI in a process variable.
Example: Create a BDM object and load in it the value of a UI field.
NOTES: If you create a BDM object, the values are alive until the end. If you create a process var, the value is alive during the process is alive.
1.- Create a BDM object in Studio with for example one attribute. For this example
bdm_object
var_to_load
The reference to the attribute will be “bdm_object.var_to_load”
2.- Add “bdm_object” at Data Panel.
3.- At Contract, add a field. For this example: “input_var”.
4.- Generate the form ( UI will be opened in design mode with one field. Only one field because you only have one attribute in Contract. UI generate fields like you say at Contract ).
4.- Go to Operations and configure: bdm_object – setvar_to_load – input_var
With this, when you execute the process, the value that you input at the form of your process at field “input_var”, and click “Submit”, will be loaded at attribute “var_to_load” of your BDM object "bdm_object ".
If you want to see the value at the next process, create a new process, add in Process Variable tab your bdm object “bdm_object” and build a form.
The next steps is in the UI of the form of the created process:
Open with UI ( the form is empty because there are nothing in Contract ), create a variable ( type “External Api” and Value “…/{{context.bdm_object_ref.link}}” where “bdm_object” is the name I say at the step 1 of my another answer ). For example, the name of the variable is “value_to_see”. It means, the variable “value_to_see” will be a copy of your bdm object “bdm_object”.
Put a Input component in form ( see the components at left ).
Click the input component and at right, where label “Value”, write: “value_to_see.var_to_load” ( where “var_to_load” is the attribute I say in step 1 of my other answer ).
That’s all.