1

What are our options for abstracting away references to user accounts in Workflows and process builder flows?

I have consultants delivering to me workflow metadata that hardcodes user emails or user-account references in. As a result when I deploy I get messages like:

Cannot find a user that matches any of the following usernames: [email protected], [email protected], [email protected]; remove the user from the component being deployed or create a matching user in the destination organization.

As I'm sure you will agree, Hardcoding a username/email into a workflow is absolutely unacceptable. What happens when a person referenced in 137 workflow rules (out of thousands) gets a promotion, gets fired, has half their job reassigned to another person, hit by a bus, etc? its just unmanageable.

So what should we be doing instead so that we can change the user in question only once, but affect all flows, and make our Metadata deployable regardless of the state of the target's Data?

PS, If you are really unclear on why I want this, its all the same reasons mentioned in these best practice articles on avoiding hardcoding IDs in components:

https://developer.salesforce.com/page/Best_Practice:_Avoid_Hardcoding_IDs

https://jenwlee.wordpress.com/2017/03/28/did-i-just-see-you-hardcode-a-salesforce-id-aw-hell-no/

2
  • 1
    One possible way is to use formulas that reference Custom Labels. Although you need to modify them once people leave and requires also to keep them updated and in mind so it's not the ideal scenario either. This is one of the reasons I prefer code over workflows sometimes for this kind of things, just a simple query where you can select dynamically whoever is in that position, instead of hardcoding id||email or whatever. Oct 4, 2018 at 16:38
  • I suppose a field is a valid approach that works across all automation types, though it does make me cringe a bit breaking 3rd normal form that way. Oct 4, 2018 at 17:10

0

You must log in to answer this question.

Browse other questions tagged .