RSS

Flow Organization – Using Multiple Assignments

26 Nov
Flow Organization – Using Multiple Assignments

Even though an Assignment element can be used to populate a large number of variables or fields, it may not always be a good idea to stuff them all into one.

Multiple Assignments in One Element

Multiple Assignments in One Element

.

But why use multiple Assignment elements when you can get by with fewer? The main reason is it gives you the ability to quickly read your flow and know what happening at each step of the way, but there is also an offshoot benefit.


Example of Using Multiple Assignment Elements

Here is an example where I’ve used multiple Assignment elements.

Using Multiple Assignments

Using Multiple Assignments

.

Now in actuality I could have put all the assignments into one or two Assignment elements, however, when I came back to the flow after some time has elapsed, I would not be able to easily “read” the flow to know what it was doing.

But even though I’m using multiple elements, that doesn’t mean that each element is updating a single variable or field. Instead I’m grouping the items into logical groups, and using an Assignment element for each group.


Offshoot Benefit of Using Multiple Assignment Elements

The offshoot benefits of using separate Assignment elements is that when you’re writing a flow with multiple logic branches and the process differs slightly from one branch to another, you can create one element, and then copy it for the different processes.

Copied Assignments for Differing Processes

Copied Assignments for Differing Processes

.

When doing this I recommend starting with the branch of your process that will have the greatest number of assignments, then move to the branch with the next fewer number of assignments, and so on.

This way after you copy your elements for the next branch you can very quickly and easily to pare down the assignments within the element by deleting the ones you don’t need. Deleting an assignment is much quicker and easier than adding a new one, it’s just one click on the trash can (versus two variable/value lookups and the selection of an operator).

Additionally, not only does it take a little time for the Cloud Flow Designer to locate your variables and fields each time you need to populate a variable or value input box, but each time you are grabbing resources you’re introducing an opportunity for a bug to crop up by mistakenly grabbing the wrong one. Trust me on this, it happens, and it will drive you crazy working out these bugs.

Here is an example of what I mean: Let’s say I have records from two different objects that I’ve called “HHERecs” and “MERecs”. Both of these objects have “StartDate” fields. If I enter “StartDate” into an input field, the Cloud Flow Designer will bring up a list of everything that matches that, which will include “HHERecs.StartDate” and “MERecs.StartDate”.

Now if you’re impatient, like I can be, you don’t really want to wait several seconds for the Cloud Flow Designer to finish creating its list of matching items, so you click on the list as soon as you see “StartDate” then move on to the next thing in your flow.

What you didn’t notice, however, is that you needed “MERecs.StartDate”, but you got “HHERecs.StartDate”. Boo.

So learn by my mistakes…create your most complex Assignment element first, then pare it down as you move to the branches of your process that require a simpler element.

Cheers!


 Links to Other Flow Organization Tips:

Advertisements
 
Leave a comment

Posted by on November 26, 2015 in Documentation, Flow Tips & Tricks, Visual Flow

 

Tags: , ,

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 )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: