Set Values for a Data Grid on Post Execution of a Workflow
- Last UpdatedJun 25, 2024
- 2 minute read
You can set values for a Data Grid, after a workflow is executed.
-
Create a form with a Data Grid, Hidden Field, and Invoke Workflow controls.
-
Create a Work Order lookup.
-
Modify properties of the Data Grid control as follows:
-
In the Basic tab, set the Configuration Name property to WorkOrder lookup created in step 2.
-
In the Advanced tab, set the script for the On Data Bound property as follows:
var gridValues = control.findById("H1").value;//"100,WO-010"
if (gridValues)
{
var workOrders = [];
var values = gridValues.split(",");
for (var i = 0; i < values.length; i++)
{
workOrders.push({ "wo_id": values[i] });
}
//grid object has to be in this json object format
//Grid object with property data which is again an object with property of workorder which is lookup name which is always an array of objects with property as perists column names
var gridValue = { Grid: { Data: { WorkOrder: workOrders } } };
//the below api is used to get xml from the object.
var gridXml = SFU.getXmlFromJSONObject(gridValue);
//grid value is encoded xml
control.value = encodeURIComponent(gridXml);
}
The script gets a value from the Hidden Field control,and sets the value for the Data Grid. The Data Grid internally selects the appropriate checkboxes.
-
-
Save the Data Grid.
-
In the Scripts tab, set the script for the Post-Workflow Execution property as follows:
control.findById("H1").value= blockingOutput;
control.findById("G1").refreshGrid();
The script sets the value for the Hidden Field control with the blocking output, and the Data Grid control is refreshed.
-
Save the Invoke Workflow.
-
During run time, select the appropriate checkboxes on the grid,and trigger the workflow using the Invoke Workflow .

-
During post execution of the workflow, the grid is refreshed and the new values are automatically selected.
