(Salesforce) Decision: My Favourite Flow Element
Have you got a favourite Flow element? No? Just me? Ah well, I’m proud to have a favourite Flow element! The Decision element allows your Flow to change shape or purpose at any point, dynamically! This means that depending what you feed it, it can do a completely different thing!
I can hear you asking why I love the Decision so much. Maybe that’s in my head… regardless, I’ll dive into it! Let’s look at an example below. I have a Flow with an input variable, inputId. The decision checks to see what the inputId value starts with. See an example below (here’s a list of all the common Id prefixes from Salesforce).
Let’s say that the Flow is given a Lead Id by a Process. This could be because, at a specific stage, we want to send an Email Alert out to the Lead’s Owner, create a Task, and increase a value on the related Project (custom object) record, but this can be handled in another Flow (Note: Flows can call other Flows).
See below, if the Id is a Lead, it is pushed to the other Flow. If it’s a Contact, a Task is created. If it’s any other object (the default outcome), post to a company wide Chatter group asking to identify/handle the record.
This is just a very simple concept that you may find handy! Let’s say you want to handle Cases and Tasks similarly in special circumstances, this would be the way to do so (obviously it would then require two different sObject variables to continue, but you’d be able to allow your Flow to handle that internally rather than having to maintain multiple Flows.