Workflow Binds

Business rules can use any of the following workflow binds to get workflow-related information like ID, states, title, etc. This bind is only valid in a workflow.

The binds can be found within the 'Binds to' dropdown as shown below.

For an additional bind that is used on a transition in a workflow, refer to the e-Signature topic. This bind forces users to re-authenticate prior to taking action in a workflow in Web UI, and ensures the security of the data being committed.

Each bind is defined in the sections below.

Configuration

To use any bind:

  1. Create a business rule as defined in the Creating a Business Rule, Function, or Library topic.

  2. Edit the business rule as defined in the Editing a Business Rule or Function topic.

  3. In the Edit Operation dialog, add the bind to a business rule, as defined in the Adding a Bind topic in the Resource Materials online help documentation.

  4. In the Edit Operation dialog, optionally add Messages, as defined in the Localized Messages for JavaScript Business Rules topic.

  5. In the Edit Operation dialog, add JavaScript to call the bind.

Important: Example scripts should not be used as-is without thorough testing, including updating the script to match object and link types that exist on your system. JavaScript variable names are case-sensitive.

Current Transition

This bind is available to track properties of a transition currently being performed in a STEP workflow. This allows JavaScript business rules access to information about the event that started the transition and to the message entered as part of submitting the event.

The bind is only available from JavaScript-based business conditions and actions executed from within the workflow. Those are actions executed ‘On Entry,’ ‘On Transition,’ or ‘On Exit’ and conditions on transitions. The bind is not available from workflow start conditions, actions executed when deadlines are reached, or conditions on conditionally mandatory attributes.

JavaScript action stores the submit message in a workflow variable

Below is an example of a JavaScript action that stores the submit message in a workflow variable. Setup includes the following prerequisites: 

  • Binding on Current Object named: node
  • Binding on Current Workflow named: workflow
  • Binding on Current Transition named: currentTransition
  • Simple Workflow Variable named: lastMessage
Copy
var workflowInstance = node.getWorkflowInstance(workflow);
var msg = currentTransition.getMessage();
if (!msg)
msg = '[none]';
workflowInstance.setSimpleVariable('lastMessage',msg);if (!msg)   

JavaScript condition checks for a message when a specific event is submitted

This is an example of a JavaScript condition that checks for presence of message when a specific event is submitted. Setup includes the following prerequisites:

  • Binding on Current Transition named: currentTransition
  • Business rule Message named: messageRequired
Copy
if (currentTransition.getEvent() &&
   'submit' == currentTransition.getEvent().getID() &&
   !currentTransition.getMessage()){
return new messageRequired();
} else {
return true;
}

getEvent() will return the event (object) used to trigger the current transition; should be null if there is no event; getMessage() will return the submit message as a string or null if no message has been supplied.

Current Workflow

This bind is available for conditions evaluated and actions executed from a workflow, giving access to the current workflow. In this example, Current Object is bound to 'currentObject' and Current Workflow is bound to 'currentWorkflow'. The code stores the assignee for the 'Enrich' task in a variable. Notice that this code will only work if the JavaScript is executed from within the workflow and current object is in the 'Enrich' state.

Copy
var assignee = currentObject.getTaskByID(currentWorkflow.getID(),"Enrich").getAssignee();   

Transition Evaluation

This bind is available to track the properties of the evaluated workflow transition, including information of why the transition may have been rejected. The bind is only available from JavaScript-based business actions executed from within the workflow. Those are actions executed ‘On Entry,’ ‘On Transition,’ or ‘On Exit.’ The bind is not available to actions on task deadlines or any conditions.

Workflow Action Owner

This bind returns the workflow state that causes the business action to be executed. The 'action owner' is the workflow state where the business action is selected on the 'On Entry' or 'On Exit' tab.

The bind returns null in the following situations:

  • The business action is selected on the 'On Transition' tab of the workflow state.

  • The business action is selected on the 'Audit Action Editor' dialog via the 'Edit Audit Action' option from the workflow Edit menu.

For more information, refer to the Business Rules and Workflows topic and the Auditing an Entire Workflow topic.

Workflow Function Home

This bind is used to retrieve information about missing mandatory attribute values and reference links for objects in workflows. While the methods used with this bind are state and transition specific, the object need not occupy the state nor transition to use this functionality. The bind is only available from JavaScript-based business actions executed from an object / mode.

Workflow Parameters

This bind allows parameters to be passed to a workflow when it is started. It is typically used for Flatplanner / page planner workflows started from the Print Flatplanner component

Workflow State

This bind allows access to Workflow State information from a Smartsheet.