Invoke Workflow
- Last UpdatedMar 12, 2025
- 4 minute read
Use scripts to set and get values for the properties of the Invoke Workflow control.
Basic
|
Property |
Scripting Supported |
Example |
|---|---|---|
|
Name |
Yes Writable Readable |
To set the property control.findById("ID").tagName = "Value for Name"; To get the value of the property control.findById("ID").tagName; |
|
XML Node |
Yes Readable |
To get the value of the property control.findById("ID").xmlNodeBoundTo; |
|
Description |
Yes Writable Readable |
To set the property control.findById("ID").description = "Value for Description"; To get the value of the property control.findById("ID").description; |
|
Tooltip |
No |
Not Applicable |
|
Button Text |
Yes Writable Readable |
To set the property control.findById("ID").buttonText = "Value for Button Text"; To get the value of the property control.findById("ID").buttonText; |
|
Workflow Details |
No |
Not Applicable |
|
XML Variable Name |
No |
Not Applicable |
|
XML Schema |
No |
Not Applicable |
Appearance
|
Property |
Scripting Supported |
Script |
|---|---|---|
|
Enable |
Yes Writable Readable |
To set the property control.findById("ID").enable = true; To get the value of the property control.findById("ID").enable; |
|
Visible |
Yes Writable Readable |
To set the property control.findById("ID").visible = true; To get the value of the property control.findById("ID").visible; |
|
Label Position |
No |
Not Applicable |
|
Label-Control Area |
No |
Not Applicable |
|
Alignment |
No |
Not Applicable |
|
Retain Space |
No |
Not Applicable |
|
Display Mode |
No |
Not Applicable |
|
Button Size |
No |
Not Applicable |
|
Image Path |
No |
Not Applicable |
|
Image Position |
No |
Not Applicable |
|
Custom Style Sheet Identifier |
No |
Not Applicable |
Validation
|
Property |
Scripting Supported |
Example |
|---|---|---|
|
Show Confirmation Message |
No |
Not Applicable |
|
Confirmation Message Text |
No |
Not Applicable |
|
Show Success Message |
No |
Not Applicable |
|
Success Message Text |
No |
Not Applicable |
Advanced
|
Property |
Scripting Supported |
Example |
|---|---|---|
|
ID |
No |
Not Applicable |
|
Execution Mode |
No |
Not Applicable |
|
Close Form |
No |
Not Applicable |
|
Form Button |
No |
Not Applicable |
Scripts
|
Property |
Scripting Supported |
Example |
|---|---|---|
|
Name |
Yes |
return "Value for Name"; |
|
Description |
Yes |
return "Value for Description"; |
|
Enable |
Yes |
return true; For more information, see scripting guidelines for Enable property. |
|
Visible |
Yes |
return true; For more information, see scripting guidelines for Visible property. |
|
Value |
Yes |
return "Value for the control"; |
|
Pre-Workflow Execution |
Yes |
return false; This script stops the execution of the workflow. Alternatively, promise object can also be used in place of above script for stopping execution of the workflow as shown below:
// Declare the promise object var promiseObj = $.Deferred();
// validation or asynchronous code logic
if (true) // when we can continue to invoke the workflow based on some condition { // Below statement would tell the process to invoke the workflow promiseObj.resolve(); } else // when there is an issue and we do not want to continue the invoke of the workflow { // Error message or any other indication can be provided by the end user as per their requirement SFU.showError(document.title, "Some error message"); // Below statement would tell the process to not invoke the workflow promiseObj.resolve(false); }
// return the promise object return promiseObj; The Pre-Workflow Execution script can be used to validate, update values in columns, and so on. Note: |
|
Post-Workflow Execution |
Yes |
control.findById("ID").value = blockingOutput; The Post-Workflow Execution script can be used to perform actions based on the workflow execution status. Note: |
Enabling Read-Only mode for the form while the workflow is processed
When a workflow is triggered through the Invoke Workflow control, we recommend to deny the user to edit values of controls on the form while the workflow is being processed.
To enable Read-Only mode for the form, you can code the script for the Pre-Workflow Execution property of the Invoke Workflow control as follows:
control.topLevelForm.readEditAddBehaviour = readEditBehaviourEnum.readOnly;
To disable Read-Only mode for the form after the workflow is processed, you can code the script for the Post-Workflow Execution property of the Invoke Workflow control as follows:
control.topLevelForm.readEditAddBehaviour = readEditBehaviourEnum.editable;
Using workflowStatus and blockingOutput Variables
Use the workflowStatus variable to accomplish a desired operation based on the workflow status, and the blockingOutput variable to accomplish a desired operation using the Blocking Output from Blocking Data Activity of the workflow. For more information on workflow status codes, see List of Internal Status Codes in the Developer Guide.
// Do something based on the workflow status.
if (workflowStatus === "FN")
{
//Workflow finished without errors.
/* Accomplish a desired operation.
* Read blockingOutput variable if the workflow is expected to return Blocking Output from Blocking Data Activity.
* Refresh the form or a control if the workflow is supposed to modify data on the form.
*/
}
else if (workflowStatus === "FE")
{
//Workflow finished with errors.
SFU.showAlert("Workflow triggered with errors.");
}
Note: The Submitted Form Details link, which appears in the BAM Report, in the Start Activity, will not be visible if the workflow is triggered using the Invoke Workflow button.