Wednesday, July 29, 2009

Cross-object Workflow in SalesForce

It is a common misunderstanding that cross-object workflow is not possible in SalesForce.com CRM. It is extremely limited and in my experience tends to only work the way I don't usually need it to work, but there is some cross-object functionality.

Say for example you have created checkbox fields on both Contact and Account records to mark them as Active or not. One might logically want the Account to be marked as "active" whenever any related Contact record is. Unfortunately, the workflow formula you need will only allow you to mark the Contact record as "active" whenever a related Account is. Not too helpful.

I will teach you the method, then leave it up to you to find useful applications in your work. To perform the above workflow between Contacts and Accounts you would do the following:
  1. Go to Setup/Create/Workflow&Approvals/Workflow Rules and create a new rule.
  2. Start with the Contact object, because you will be updating a field on that object, and you cannot do field updates across standard objects.
  3. Under field criteria, choose field "Account: Active" and operator "Equals" and value "Yes"
  4. Hit Save and next (after naming the rule of course and making sure it is set to trigger upon creation, edit, etc. as you desire)
  5. Create the workflow action "new field update"
  6. Enter the naming you desire and set the field to update to be the field called "Active"
  7. Specify the new field value of "yes"

You can also create the workflow rule that uses this field update by using "formula evaluates to true" instead of "criteria are met" under the rule criteria. The advantage of doing this is that sometimes more objects are available through lookup relationships when using the formula rather than just the drop-down lists of fields.

Here are a couple of examples that may actually be a bit more useful to you. These come from SalesForce's help files:

Update Case record based on values on related Account record:

Send email alert when Case is created related to certain Accounts, based on field values on the Account record:

A final note from SFDC help files on when and how you can use field updates with workflow rules:

"For standard objects, workflow rules can only perform field updates on the object related to the rule. The exceptions are that both Case Comments and Email Messages can perform cross-object field updates on Cases. For all custom objects, however, you can create workflow actions where a change to a detail record updates a field on the related master record. Cross-object field updates only work for master/detail relationships."

I welcome your sharing of other useful cross-object workflow rules you have been able to create among standard SalesForce objects. This is hopefully an area that SFDC intends to build out further in future releases. For example, I think a lot of people would love to be able to update status fields on Contact or Opportunity records whenever certain Tasks are marked as "Completed." I can think of dozens of helpful use cases for more cross-object workflow. Right now we are pretty much dependent on very limited native functionality and Apex coding to go beyond that.

Important Addendum: I was remiss in leaving out an important caveat about doing cross-object workflow. Note that even though the rules will work across the objects, you won't actually get the ones on the resultant object to fire until it is edited. It doesn't matter what change, if any, is made to the record, but the rules won't evaluate on object A simply because object B was edited, even if it is the new criteria on object B that cause it to meet object A rule's criteria.

AspiraTech has developed Aspira Xobject as a solution to this problem. Using Aspira Xobject, which is available for download on the AppExchange, you can connect any two objects so that workflow rules on one get evaluated whenever the other is edited. Check it out.

Labels: ,

Bookmark and Share

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home