The requirement of auditing the value changes in key fields is one of the common requirements. One can use audit trail or resort to activities for maintaining log. We also faced the same requirement of capturing the Old Value-New value pair in activities, whenever status of Service Request is changed.
There are multiple script less solution available for this. But the one which excited us was the introduction of "GetOldFieldValue" method of buscomp. As per bookshelf
"This method can be called by using a script in the PreWriteRecord event to retrieve an old field value if needed. This method takes an input parameter, which must be a valid field name, and returns a string containing the old field value."
Primarily this method is used for EBC's but one can use this method for any buscomp with effective use. We created a workflow which is used to read older value and new value and then create activity.
1 - Fetch Old Value
Business Service Name: SIS OM PMT Service
Business Service Method:Invoke BC Method
Input Argument
BC Name : Servcie Request
MethodName: GetOldFieldValue
Param 0: Status
OutPut Argument
Type: Output Argument
Output Argument : Return Property Name
Property Name: OldStatus (input property set created for storing Older Value)
2 - Fetch New Value
Business Service Name: Workflow Utilities
Business Service Method: Echo
Input Argument
OutPut Argument
Type: Business component
Business component Name: Service Request
Business Component Field: Status
Property Name: NewStatus
3 - Create Activity
Business Service Name: Inbound E-mail Database Operations
Business Service Method: InsertRecord
Input Argument
BusComp : Action
BusObj: Service Request
Field: SR Id : Object Id
Field: Description: "Status has been Changed from" + [&OldStatus] + "to" + [&NewStatus]
Echo still remains one of the most mysterious yet powerful method. This workflow can be invoked via runtime event on Service Request buscomp.
Happy Auditing!!
1 comment:
This is super cool.
Thanks,
Rajesh
Post a Comment