Once you have retrieved the Step Elements or Work Objects from a queue (for details and examples, see Querying for Step Elements or Work Objects), you can update workflow data, such as updating VWStepElement parameters (e.g., modifying the data fields, attachments, and workflow groups that are used as parameters for this workflow step), or updating VWWorkObject objects (extracting and updating data field values).
Step Element parameters on a step are defined by:
These parameters are defined using the Parameter tab in the Process Designer (for information, see Help for Process Designer).
Actions associated with updating workflow data include updating Step Element parameters, extracting Work Object data field values, setting comments, etc. Once parameters, etc. have been updated, you may complete the step (for details and examples, see Completing the Step).
This topic provides sample code these types of actions, as follows:
Note Remember to lock the retrieved work item before you update (these actions assume you have locked the data record). For example, using the doLock() method:
vwStepElement.doLock(true);
The following example code illustrates retrieving Step Element parameter values from a queue using the VWStepElement.getParameterValue() API method and then updating the value using the setParameterValue() API method:
//retrieve Step Element Parameter values Object value = VWStepElement.getParameterValue(); //set the Parameter values VWStepElement.setParameterValue(name, value);
The following example code illustrates extracting and updating the data field values from work objects retrieved from a queue using the getFieldValue(), hasFieldName(), and setFieldValue() API methods:
if (workObject.hasFieldName("AppID")) { appID = (Integer)workObject.getFieldValue("AppID"); } if (workObject.hasFieldName("Title")) { workObject.setFieldValue("Title", New Title); }
The following example code illustrates two ways of setting a comment:
1. Set a comment using the setComment() API method:
vwStepElement.setComment("This is the user's comment.");
2. Or set a comment using the F_Comment field for the hasFieldValue() and setFieldName() API methods:
if (workObject.hasFieldName("F_Comment")) { workObject.setFieldValue("F_Comment", "This is the user's comment.", true); }