Workflow Utilities Business Service, Echo Method – A case study
Requirements:
When a user decreases the revenue amount of an opportunity, an activity should document this, indicating the old amount, the new amount and the difference.
Solution:
1. The solution uses runtime events, profile attributes and – of course –Siebel Workflow.
2. First we capture the old value of the field in the PreSetFieldValue event and save it to a profile attribute.
3. The workflow is invoked at the (Post) SetFieldValue event. It compares the values and creates the activity record if the new value is lower than the old value.
Here are the detailed steps:
Examples of input parameters can be seen below.
1. Create an action set to capture the old value.
Runtime Events are a great vehicle to capture data manipulation in Siebel CRM. We can navigate to the Action Sets view in the Administration – Runtime Events and create a new action set with the following data for the only action record:
Action Type: Attribute Set
Profile Attribute: ABC_OLD_REVENUE (ensure you choose a unique name)
Set Operator: Set
Value: [Primary Revenue Amount] (including the square brackets)
2. Create a runtime event
Create a runtime event as follows:
Object Type: BusComp
Object Name: Opportunity
Event: PreSetFieldValue
Subevent: Primary Revenue Amount
Action Set: (Pick the action set created in step 1)
3. Create the workflow
The workflow uses the following steps:
- Start
- Business Service (Workflow Utilities/Echo)
- Decision
- Siebel Operation (Action/Insert)
- End
Next, we create three process properties (with Number as the data type)
- Old_Revenue
- New_Revenue
- Diff
I use the Workflow Utilities business service’s Echo method twice. The first instance does the following in the Output Arguments:
Populate Old_Revenue with GetProfileAttr(“ABC_OLD_REVENUE”)
Populate New_Revenue with Opportunity.Primary Revenue Amount (BC and Field)
The second instance calculates the difference as follows and populates the Diff property with the following challenging formula.[&Old_Revenue] – [&New_Revenue]
This means when the difference is greater than zero, the revenue amount has decreased. (Note: For some reason, this only works when using the Echo method twice).The decision branch is chosen when the Diff process property is greater than zero.
In the Siebel Operation step, we insert a new record for the Action BC and set the Description field as follows:
“Revenue Amount has decreased by ” + [&Diff] + ” from ” + [&Old_Revenue] + ” to ” + [&New_Revenue] + “.”
Finally, we set the runtime event condition on the branch which originates from the Start step to the following:
Event Object Type: BusComp
Event Object: Opportunity
Event: SetFieldValue
Subevent: Primary Revenue Amount
4. Publish and activate the workflow.
5. Reload the runtime event cache.