So here’s the thing. I WAS going to write a short series of blog posts on How to Get Started on Visual Workflow. It was to be a Great Work, a definitive treatise bringing clarity, insight and edification to the lay user, its sole purpose being to exist in this world as an utter personification of knowledge.
Then I saw Keith Sadler had beaten me to it.
Check out his awesome Part 1 and Part 2 blog posts over at ButtonClickAdmin.com to learn how to use Flow and get started on your very own real-world very-useful sample Flow. I’ve had some conversations with Keith, and I know first-hand that he really knows his stuff.
I LOVE Post-It Notes. I don’t use them as much as I should, due to an overwhelming and logic-disregarding need to use as little paper as possible. I mean, come on, this is the future, right? The only thing we’re missing is flying cars. Paper is soooo 2nd Century BC. Even Evernote is trying to digitize them.
Post-It Notes serve many functions, but one of the most useful ones is to serve as not just task reminders, but as impromptu cubicle posters: tiny pastel-colored mantras that remind us not just to pick up the milk, but to think or act in certain ways. An inspirational poster with your favorite motivational quote will often cost upwards of $5-10, but writing it in pen on a Post-It and sticking it on the edge of your monitor costs pennies at most, with the added bonus of taking up less space!
Many such mantras are important for Salesforce Admins, or even for working people in general. I’m sure each of us knows at least one co-worker who would have benefited from having Wheaton’s Law permanently affixed to a prominent location in their workspace. And then there are the timeless admin Rules of Being Awesome put forth by Mike Gerholdt and the other MVPs; edicts like “Always build in the sandbox first”, or “Create trust in your data”, or “Communicate all changes!” These are, and shall ever be, key to success as an admin.
As such, I have come to call mantras like these “Post-Its”. They are friendly reminders on how best to work, and when it comes to Flow, there are certain “Post-Its” that one must remember as they begin their Flow journey. These are things that are not necessarily apparent, but crucial to keep in mind as you build your first Flows.
1. It’s Like a Flowchart, But It Does Stuff
If you ever have trouble wrapping your head around how exactly to build your Flow, the thing to remember is that it is, at its heart, a flowchart. If you’ve ever used Visio, OmniGraffle, Diagramly, or any of the myriad of programs that allow you to drop in shapes, write text, and draw arrows, you’ve done half of the work in Visual Workflow. The difference is, each of those Visio boxes can now be set up to DO something. ANYTHING. It’s extremely powerful!
Conversely, Flow works just like those charts do. It will only do things in the order in which you set them, and it will do things EXACTLY as you tell it to. Quite honestly, it is usually a great help to FIRST write out the flow you are thinking of, on paper or even in Visio, just to wrap your head around the logic, branching, assignments, and general order of things.
2. Screens Not Necessary (Mostly)
Almost every example or sample flow that you’ll see will have a Screen in it. And for the most part, great. Awesome. Communication is good. Generally speaking, you want to talk to your users as much as possible.
But what if you really don’t need to tell the user anything?
The thing to remember is that Visual Workflow has Workflow as its base. It can do nearly everything Workflow can, except that it has to fire off of a link or button. But in that sense, it can be treated like workflow.
Workflow doesn’t tell you when it’s completed successfully, does it? It just works. The same can apply to Visual Workflow as well. If you’re completing some simple automation with your link or button and you don’t need to obtain any additional information along the way,
Now I say this, but remember, my young Padawan, that only a Force.com Sith deals in absolutes. There are exceptions to every rule. Even if you don’t need to get any information or show a Finish screen, ALWAYS put in at least one Screen as an Error message/Fault. Generally speaking, each Record Create or Record Update should go to a Fault of some kind, even if they just share one.
3. Affect as Much as You Can
Flow is powerful, and frankly it can sometimes be easy to forget just how powerful it is. So you’ve finished that Flow that updates a Case from a custom object. Why stop there? You could update that Account field which tracks your overall Case status, make a Chatter post, send a Task to a manager to follow-up, and make a new Idea record, all with one click.
Obviously, you won’t necessarily want to go crazy with it. THE major hallmark of a solid project is a clearly-defined scope, and in any project your goal should be to stick to that scope. But thinking along these lines can help you to plan ahead of time, to (quite literally) go with the Flow. On more than one occasion, I’ve found myself listening to the request of a director or manager, and the more I think about all the different ways in which their department touches other departments, the more ways I find to connect the objects through synchronized cross-object data updates. Those connections create extra value in your system, leading to easier reporting and more complete data!
4. Install the Getting Started Pack (and filter out most of it)
On the AppExchange, you’ll find a hidden gem from Salesforce Labs called Visual Workflow Getting Started Pack. My advice: get this installed as soon as possible. Even once you do, you’ll have to sieve away a good amount of what is included to get to the gold nugget inside. That nugget is a little Apex plug-in that lets you send emails from Visual Workflow, an invaluable tool for communication in any organization that hasn’t fulled embraced Chatter or is trying to reduce Chatter clutter.
The one problem with this pack is all of the other things that come with it. There are a few other plugins that may or may not see any use, and a lot of sample plugins that, quite honestly, cease to be of any use after a certain point. Do yourself a favor and make a Flow view that filters out all the flows you no longer need.
5. Think Outside the Flow
I absolutely ADORE Flow like it was one of my children, but even the most loving parent should be aware of their loved one’s limitations. It is but one tool in the toolbox, and as powerful as it is, it’s no good at things like simple math or formula functions (e.g. LEFT, YEAR, SUBSTITUTE). You want to include the year of the created date in the name of your newly created record? Sorry chum. You want to create a Task, but you want that due date to be two weeks from the date the user specified in the Flow’s Screen questions? Good luck.
BUT there are ways of getting around those limitations. The key is to remember that Flow is but part of the Wide World of Salesforce, and it can interact with the other parts. Let’s look at the first problem: somehow parsing out just the year of the created date.
- Set up a workflow that fires off when this type of record is created. Make it perform a Field Update that does the concatenation onto the record name, pulling whatever naming data you need. You can easily do the YEAR method on the CreatedDate as part of your Field Update; it’ll calculate it on the fly for you.
- If a user creates the record manually, you can still have this apply. Just be sure to tell your users that the Name field will be filled in automatically, but because it’s a universally-required field (being a Name field core to all Salesforce objects), they’ll have to put something in before hitting Save. Anything will do. Hit the letter A and call it good. It’ll just get overwritten by your Workflow, as it should!
- If you need it to only do this update on records created by the Flow, create a new checkbox field (not on any page layout, your users don’t need to be able to mess with this one!) called Generated by Flow. Have the Flow mark this as True when it runs, and edit the Workflow rule so that it only goes off when Generated by Flow is True.
See? We’ve combined Workflow and Flow seamlessly. Now let’s look at the other problem: adding days to a date specified during the Flow.
- Get the date from the user in a Screen. Simple enough.
- Immediately do a Record Update after the Screen, pushing the entered date into a new field. (Again, you can simply not put this on a page layout, if users don’t need to see it and you don’t want them tinkering with it after the fact.)
- Here, you can go two different ways. You could A) make Workflow that created a Task and added the time as needed, or B) create a new formula field that simply does the addition of the days to that given date.
- Make a Record Lookup to pull that formula field back into your flow, and make your Task as needed! (Remember that Tasks created with Flow can be assigned to a dynamically-determined user, rather than being stuck on a single name like Workflow does.)
Because Flow runs in order and doesn’t have to finish to do its work, your data can hop in and out of Flow! Anything that you can’t do in Flow, you can pass outside to the tools that CAN. Then pass it back and it’s like automagic!
The key in all of this is to make Flow work for you. The possibilities are nearly endless, and often it’s just a matter of figuring out the right path. Unless you’re talking about firing Flow without a button or link, don’t EVER let yourself think that something can’t be done in Flow!
P.S. Document and Communicate Like Your Life Depends On It!
OH one more thing! As a good admin, what should you do every time you release new functionality or replace old functionality? And when you release a new Flow, aren’t you usually releasing new functionality or replacing old?
The same thing applies here. ALWAYS document your new Flow, distribute that documentation to all relevant users, and do training/Q&A sessions to ensure that your users are properly able to use what you’ve given them. I’m not always the best at this, like a lot of admins, but I can tell you firsthand that the surest way to letting your users believe that you just sit and twiddle your thumbs all the ding-dong day is to not tell them what you HAVE done. Plus, you’ll alleviate the eventual head-hit-desk migraine and drive-to-drink, that you’ll undoubtedly encounter when you find that they’re using your carefully-crafted tool in entirely the wrong way.