The Step Completion widget acts as a controller that coordinates the launch and dispatch of work items based on user activities. When you include the Step Completion widget on a page, the widget provides the data that the other step processor widgets require to process work items as a user performs create, update, save, and complete activities.
Update mode initialization activity
When a user opens an existing work item, the Step Completion widget receives an Open Work Item event that contains the ID of the work item. The widget initializes update mode and functions as a step processor.
To initialize update mode, the Step Completion widget passes the work item ID to the Process Engine REST Service to retrieve the work item. The widget locks the work item to prevent other users from updating it.
Create mode initialization activity
When a user creates a new work item, the Step Completion widget receives a New Work Item event that contains the name of the workflow with which the work item is to be associated. The Step Completion widget then passes the name to the Process Engine REST Service to get the field definitions for the launch step. The Step Completion widget then uses the field definitions to create the WorkItem payload.
The Step Completion widget sends the WorkItem payload to the Header widget, the Work Data widget or Work Data eForm widget, Attachment widget, and the Process History widget. These widgets then render their UIs according to this payload.
Save, complete, and create activities
When the save action, complete action, or create action is triggered, the Step Completion widget publishes the Send Save Work Item event to the Work Data widget or Work Data eForm widget, and the Attachment widget.
When the SaveWorkItem payload arrives, the receiving widgets validate the user input and pass data fields back to the Step Completion widget by invoking a callback function specified in the SaveWorkitem event payload.
After all callback functions return, the Step Completion widget collects the results of the callback functions and generates a work item containing all user inputs. The work item is updated by using a single Process Engine REST Service call.
If an error occurs, for example, if a user does not enter a required field, the Step Completion widget stops the flow of execution and displays a modal dialog box indicating the error. Alternatively, the widget that raises the error can display an inline error message.
After the work item is ready, the Step Completion widget publishes the Send Work Item event to the Header widget, the Work Data widget or Work Data eForm widget, the Attachment widget, and the Process History widget with the WorkItem payload. These widgets then consume the WorkItem payload object and render the UI again.
When the close action is triggered, the Step Completion widget publishes the Send Close Work Item event, which notifies the Work Data widget or Work Data eForm widget, and the Attachment widget that the step processor page is being closed. The Work Data widget or Work Data eForm widget and the Attachment widget are then triggered to check whether the user has modified the value of a workflow field. If a field has been modified, the user is prompted whether or not to abandon their modifications.
Before returning to the main page, the Step Completion widget publishes Close Step Processor event. The user then is returned to the main page from which the work item was launched.
Parent topic: Step Completion widget : ECM Widgets 22.214.171.124