Triggering Workflow Events from Imports
If a workflow is valid for either products, classifications, assets, or entities, it is possible to configure the workflow to automatically trigger certain transitions if an object in the workflow has an attribute value changed in an import as long as the event on the transition has the ID of 'stibo.import'. This is helpful in that a user does not have to recheck any existing items that are already in the desired workflow, nor do they have to take the objects out to be updated, only to put them back into the workflow again. Instead, the objects already initiated into the workflow will be updated and then be triggered to move to the next sate, if the event on the transition has the proper ID.
For example, a user has Object A in their desired workflow in the Initial state. The Initial state has an event on the transition coming out of it with the ID of 'stibo.import' going to State 2. The user updates and imports objects, one of which is Object A. Due to the setup of the Initial state, Object A is updated, and an event is triggered moving Object A to State 2.
Condition for Triggering Workflow Events from Imports
To turn on this functionality for a workflow, select the desired workflow in System Setup and check the Listen on updates from import checkbox on the STEP Workflow Editor tab.
Make sure that any events that should occur have the proper ID. Again, the Import Manager can only trigger events with the ID 'stibo.import'. Thus to have a transition performed for an object in a workflow when it is changed in an import, the object must be in a state out of which there is a transition with the Event 'stibo.import' (the 'stibo.import' event will not be visible in the STEP Workflow Items editor or on the Object Tasks tab).
Note: It is important to notice that only changes to attribute values (add, modify, remove) will trigger the 'stibo.import' event. Thus, changing a reference, re-parenting an object or similar will not cause the event.
The image below shows a simple workflow with the functionality turned on:
The 'stibo.import' event is on the transition from the First state to the Second state and thus, if an object is in the First state and an attribute value is changed in an import, the transition will be performed.
When working with events generated by imports, there is a special reserved variable named 'modifiedAttributes' available in JavaScript. This variable will hold a list of IDs of the attributes changed in the import. In looking at the example above, the variable will be available when leaving the 'First' state (On Exit), on the transition (On Transition + Condition) and when entering the state to which the transition goes (On Entry on the Second state).
Using this reserved variable, a user could, for instance, add a condition on the transition only allowing the transition if a specific attribute has been changed and has a value after the import. This could be done with a script as follows:
var attChanged = false; var modArray = modifiedAttributes.toArray(); var modifiedAttributes = params.get("modifiedAttributes"); for(var i = 0; i < modArray.length; i++) { if(modArray[i] == "ID of Attribute") { attChanged = true; break; } } if(attChanged && node.getValue("ID of Attribute").getSimpleValue()) { condition = true; } else { condition = false; }
Note: In the script above, the node corresponds to the Current Object bind, and the parameters correspond to the Workflow Parameters bind. Refer to the image below.
It is optional for users running imports whether or not the import potentially should trigger events. Thus, for column based imports, in the Import Manger on the Advanced Settings page, the checkbox 'Trigger STEP Workflow import events on Item Updates' controls whether or not events should be triggered.
In XML, the functionality is enabled / disabled using the STEPProductInformation tag attribute 'STEPWorkflowImportEvent' that can be set to 'Y' or 'N'.
Since it is optional for users whether events should be triggered, the functionality is typically used in imports based on pre-configured import configurations. A use case could be one where an object is in a state waiting for data to arrive from an external system via an Inbound Integration Endpoint.
Note: It is only possible to trigger events from imports when running in Domain mode.