Simple Parent/Child Flow with Decision

Here’s an example of a “simple” flow that uses a Decision element. You don’t need to use flow to achieve the results – you could entirely stick to Process Builder. This flow is for educational purposes only.

Here’s the sitch: I want an automatic email to my customer when we quote a specific product.  For example, “Dear Darnell McCustomer, for a limited time only, you can purchase the EDGE widget for $150!”

Caveat: I want this to be in an HTML template, not a Visualforce email, based on the Quote object. I can’t reach the price on the Quote Line Item from Quote in this format.

Solution: I created a custom field for the price on the Quote, and wrote a flow to populate that field when a Quote Line Item for EDGE is created. The flow is auto-launched from Process Builder.

Scope Change: Oh, wait now there is EDGE Plus Widget, too! We will only sell one at a time, never both. Update the Process Builder to look for either product and update the flow!

overall flow

Let’s look at each step. (I blurred the product name a bit). Look up the EDGE line item and store the price.

lookup edge

Lookup the EDGE Plus Line Item and store it’s price. Note for each lookup I check the box at the bottom to “Assign null values…”

lookup edgeplus

It’s decision time! Which price variable is null, and which is populated? We have two possible outcomes of this decision, “Edge” or “Edge Plus.”

decision 3bDecision 3a

Drag each decision to the appropriate record update box.

edge 4

edge5

Conclusion: You now see how you can use a Decision to update a record.

Food for Thought: The decision, in this case, was completely unnecessary.  The Process Builder could send the price of the Line Item to a variable, say, “LineItemPrice” and we could update the Quote record with that Price. The variable will hold the value of the Line Item, whether it is EDGE or EDGEPlus, because there will only ever be one line item for those two products at a time. Are you following? You may then think, “What is the flow even for? I could just update the quote in Process Builder.” And you’d be correct.

 

 

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 )

Google+ photo

You are commenting using your Google+ 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 )

w

Connecting to %s