Salesforce Cross-Object Formulas: This is Not the $User You Are Looking For

Cross-object formulas are a great way to provide access to fields on related records, for display or in calculations. As an example, rather than redoing your work (and increasing the likelihood of errors) by recreating an Account:Top Account field on Opportunities, you can use a cross-object formula to pull the associated Account’s value onto the Opportunity layout and maintain your one source of truth.

Likewise, since every record in Salesforce has an owner, you can use a formula to access data from the User record as well, but be careful how you go about it.

In this example, for a custom object called Equipment Request created to represent demo products that you want to loan out for a sales call or a trial period of some sort, let’s say you want to put an Approval Process in place to allow the manager to sign-off on the transaction.

On the User record, we’ve added an Approval Limit field to indicate how much inventory a given Sales user can request. Our goal is to pull that User: Approval Limit field onto the Equipment Request object so that the manager can easily gauge whether or not the request should be approved.

When you go to create the formula, you are presented with a list of options/objects from which to start:

Your initial reaction may be to select the following field:

$User > Approval Limit :

This is pulling the correct field, but not from the person who is making the request. This will display the Approval Limit of the person viewing the record, not the owner of the record. This means that for every Equipment Request that our Sales Director Shelly looks at, the Approval Limit that she sees will be her own, rather than Bob’s, the team member making the request.

Example #1:

Name: Bob’s 3rd Equipment Request this Month
Team Member: Bob
Description: 1 Dell XPS, Extreme Gaming Option
Cost: $2750.99
(Shelly’s) Approval Limit: $10000.00

What we really want is the Team Member’s Approval Limit, which we access by selecting the field:

$Equipment Request > Team Member > Approval Limit

This still accesses the User table, but pulls the user data related to the Equipment Request:Team Member rather than the person viewing the data in Salesforce:

Example #2:

Name: Bob’s 3rd Equipment Request this Month
Team Member: Bob
Description: 1 Dell XPS, Extreme Gaming Option
Cost: $2750.99
(Bob’s) Approval Limit: $1000.00

You should always have a test plan in place to catch these types of issues anyway, but forewarned is forearmed, yes?

Photo credit: LucasFilm

 

Meet the OpFocus Team at Dreamforce

That’s right! The OpFocus team will be at Dreamforce to soak in all the information that Salesforce.com has to offer and meet with old and new friends alike. If you are a customer, a friend or a fan of OpFocus, please let us know if you will be attending Dreamforce. We would love to see you there!