Thursday, January 16, 2014

Cross-Object Workflow in Salesforce.com

With Spring '12 Release, cross-object field updates in workflow rules and approval processes now support standard objects. Both custom-to-standard and limited standard-to-standard relationships are supported.
This feature only available in Enterprise and Unlimited edition.

Only Master-Detail relationship support using cross-object workflow, so cross-object will not work in Lookup relationship.

Here is a sample case for using Cross-Object workflow.
Master object: Customer__c
Child object: Order__c
Company would like to know how much and when latest order for each customer, but date use to determine is payment date, not order date, and payment date will be blank when customer have not make payment.

So, here we go:
1. Create a workflow in Order which will run on create and every time edit
Rule criteria:
NOT ISNULL( Payment_Date__c ) && 
( Payment_Date__c >= Customer__r.Payment_Date_hidden__c || 
  ISNULL( Customer__r.Payment_Date_hidden__c )) 
Explanation:
- if payment date is blank, stop workflow
- if payment date in order is newer than stored payment date in customer, proceed workflow OR
- if stored payment date in customer is blank

2. Create field update in Order
a. Update Payment Date in Customer
Select object = Order
Field to Update = Customer, the select field Payment Date
Formula Value = Payment_Date__c from Order

b. Update Amount in Customer
Select object = Order
Field to Update = Customer, the select field Amount

Formula Value = Amount__c from Order


If you see in above field update process, workflow in Order will update field in Customer.


For more information and standard objects supported, see this release document and find section Cross-Object Workflow.

0 comments:

Post a Comment

 
| ,