RSS

Cross Referencing Fields in Visual Flow

13 Apr
Cross Referencing Fields in Visual Flow

April 13, 2015

Cross referenced fields are the fields on another object that you can reach out to from your starting object. For instance, if you want to access a field in the Contact record from a custom object that is linked to the Contact object, you can do this in your flow without doing a Lookup to the Contact record.

LinkedObjects

A custom object linked to the Contact object

The syntax for a cross reference in a Flow follows the same rules as in other areas of Salesforce: “LinkFieldNameOnStartObject__r.EndObjectFieldName”. For example, let’s say you have already done a FastLookup or RecordLookup to a Contact record and you now need the name of the Account that contact is associated with.  Instead of using another Lookup to get the Account record, you use a cross reference to access any of the fields on the account, like “Account.Name” or “Account.CustomFieldName__c”.

In my example I have a custom object with an API name of MembEnroll__c that is linked to a Contact record. In my Flow I needed to get a custom field on the Contact record called “MembType__c”, but I didn’t want to waste another Lookup to do this (especially since the Lookup would be located within a loop).

But what I found is that the Flow would not allow cross referencing in an Assignment element. Bummer!

AssignmentUsingCrossReference

Cross reference in Assignment doesn’t work

Luckily I figured out a work-around that is relatively easy, but does require an extra step that seems a little silly to have to do, but such is the way of things, right?

The workaround is to do the cross reference in a formula and then use the formula in the Assignment element.

FormulaForCrossReference

Formula to access the cross-referenced field. In this case my start object is a loop variable (“MembEnrollLoopVar”), the field that links to the Contact record is named “Member__c” and the field I want to access is “MembType__c”.

AssignmentUsingCrossReferenceFormula

Using the formula in the Assignment element to get the MembType__c field on Contact.

There you have it.

Cheers!

Advertisements
 
2 Comments

Posted by on April 13, 2015 in Visual Flow

 

Tags: , ,

2 responses to “Cross Referencing Fields in Visual Flow

  1. Backlinks for crypto

    November 17, 2015 at 5:37 am

    Saved as a favorite, I like your blog!

    Like

     
  2. Tyler

    August 20, 2016 at 5:10 am

    This is genius! Thank you

    Like

     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: