Recently, a client approached me with a more complicated requirement than usual. I love a challenge, so I listened with great enthusiasm. The scenario below is a simplified version of the issue.

In Salesforce, the contact object had a field called “Status”. The value for this field was sourced from three related child objects. If child object A’s field “Passed” was set to true, then contact Status was updated from “In Progress” to “Passed”. If object B’s field “Work Status” was changed, then the contact Status was set to something else.

To start tackling this challenge, I mapped out all possible scenarios. Then I translated them into a super-mega-crazy-awesome “if .. then” statement. This mapping quickly exploded with nested “ifs”, as there were some circumstances in which they didn’t want to update the Status field, or only wanted to update it when multiple source fields has specific values.

The curveball to this, if a source field was reverted, the Status field also had to be reverted. In the example above, of object A’s Passed was later unchecked, then the Status was reverted from “Passed” back to “In Progress”. However, if the Status field was updated from another source before the revert happened, then you’re in an entirely different part of the if .. then statement. Cool challenge, eh?

The takeaway
Conceptually, how would you approach this challenge? I’ll provide my answer in tomorrow’s email.

Category:
Salesforce