Changing the value of Data objects in your process
You have created a couple of Process Data Objects while modeling the SalesToContract process. However, you have never initialized those Data objects.
The following Data objects were created during modeling:
BusinessAnalystOutcome
(to hold the outcome of the Business Analyst Review User task)approveDealOutcome
(to hold the outcome of the Approve Deal User task)approveTermsOutcome
(To hold the outcome of the Approve Terms User task)
Let's try to change Process Data object values and initialize them in the process.
How to do it...
1. Go to Component Palette | BPM | Default Activity and select the Script task activity.
2. You will use this activity to initialize the
Quote
Data objects.3. In the Sales Representative swimlane, click where you want to position the Script task activity. Click between the Start event and the Enter Quote User task, to position Script Task.
4. Once the Script task| Properties dialog opens, enter the following information in the properties dialog:
In the Basic tab, enter Name =
Initialize Quote
In the Implementation tab
Chose Implementation Type = Script task
Check Use Association
Click the Edit button to the right of the Use Associations checkbox
5. The Data Associations editing dialog will open.
6. On the right side of the dialog box, list the Data objects created so far in the process.
7. Drag the
BusinessAnalystReviewRequired
process Data objects to the Data Associations editor. This will open a blank box with an Expression Builder, as shown in the following screenshot.8. Click on Expression Builder to assign values to this Data object, say
BusinessAnalystReviewRequired
Data object:9. In the Expression Builder dialog, choose XPath Exp for Mode:
10. In the Expression editor, enter
false()
to assignfalse()
as initial value to the BusinessAnalystReviewRequire Data object.11. Click OK, and when you have finished the preceding steps, click Save.
How it works...
Script Tasks are used to change Process Data objects values. So when the process token reaches the script task, it will initialize those Data objects.
The script task is used to:
Change values of Data objects within your process
Change the values of Data objects outside of another flow object
Set initial values of Data objects at the beginning of a process
Project Data objects are Data objects that you define in a project. As with other flow objects that accept data associations, you can use expressions to change the values of Data objects.