Today we’re bringing you Carissa’s best practices for screen flows, continued from last week’s Best Practices for All Flow Types…
Scroll down for the details, or click the links below to jump right to the best practice:
- Formatting Text
- Customize Buttons
- Use Data Tables
- Provide Helpful Error Messages
- Launch Flows with Actions
- Use Screens and Loops for Multiple Records
- Use Subflows for Repetitive Tasks
- Use Stages and Progress Bars
- On Screen Error Messages
Best Practice #1: Formatting Text
This is a simple one, but important. Keep the format of your text the same across ALL flows – ideally throughout your entire org. In my experience, I like to mash-up what marketing wants with what’s easiest in Salesforce. This usually means using colors from the brand palette as defined by marketing (for things like Page Headers) and utilizing the Salesforce font (because that’s what will default anyway)
Bonus Tip: Make a lightning component for each item that admins will need to use consistently – like a header. You can control the styling within the component, and the flow builder just needs to add the text for the header
Best Practice #2: Customize Buttons
There was a time I’d point anyone who asked about this functionality to the Navigation Button Component from Unofficial SF. However, you can now update the text on flow buttons. So, ask yourself this question:
Do I need to ask the user a question that decides what they’ll do next? (i.e. “Do you want to create another record”)
If Yes: Then definitely use the custom component! It will allow you to just add a “Save” button and a “Save & Add Another” button in tandem with a decision element, rather than needing an additional screen component
If No: Just update the custom text on the flow screen (if applicable)
Best Practice #3: Utilize Data Tables
When you want to show multiple records to a user (think confirming records to create or allow
selecting records to delete) – the UnofficialSF Datatable component can be your best friend. It also takes advantage of custom property editors – this means it’s even easier to make changes to the component
Bonus Tip: Set a maximum number of records to keep the page clean (10 is usually a good starting
point)
Best Practice #4: Provide Helpful Error Messages
If you’re following the best practices from my last post, then you are working towards a special flow just for errors. Here’s what I suggest you include on the screen presented to users:
- A simple header – Let this fall in line with your corporate culture. Maybe it says “Well this is awkward” or maybe it says “Something Went Wrong”
- A meaningful message – I like this to reflect something specific to what went wrong, and also tell the user whether I want them to try again – OR if I want them to wait until I have time to look into it.
No matter what your error messages look like, just remember that not everyone speaks salesforce – so make it end-user friendly!
Best Practice #5: Launch Flows with Actions
If you’ve been in the Salesforce ecosystem for a while, you may be used to yester year, when we had to launch flows with a URL button. In today’s world, though, you need a REALLY good reason to do so – 99% of the time, you can get your needs met with an action and some input variables. Just remember to define the recordId
input variable!
Best Practice #6: Use Screens and Loops for Multiple Records
As you’ll recall from last week’s post, I have witnessed a Screen > Create Record > Screen > Decision > Back to the first screen
flow set up. Don’t do that. Instead, set up something that’s roughly
- Screen to do a thing – with those custom buttons we mentioned above
- An Assignment to set the values from the screen to a record variable and add the variable to a collection
- Decision to decide what button was pushed
- If Yes Add More – return to the screen for data entry
- If No, That’s All – do the next thing
Best Practice #7: Use Subflows for Repetitive Tasks
Establish a rule for “How many Elements merit a subflow” – my usual go to is about 4. And since we’re talking about subflows….
- DO NOT nest subflows within subflows – try to keep navigating through subflows at the parent level
- DO use outputs from subflows, rather than creating variables just to store these things
- DO do as much database processing in the parent flow as possible – I like to use a boolean variable in my subflows to tell them whether they’re processing data or if the parent flow is
- DO use record input variables – if you’re getting records in your parent flow, just pass them down to your subflow and save yourself the DML limit
Best Practice #8: Use Stages & Progress Bars
Again, set a standard for your org for “How many screens need progress bars”. Once you do that, utilize the progress bar component you’ve already built, in conjunction with Flow Stages. If you’ve never worked with Flow Stages before, remember to assign the current stage as you navigate through the flow.
Best Practice #9: On Screen Error Messages
Honestly, this merits a post all on its own. But in a nutshell: Utilize Decisions, Boolean Variables, and Assignments to determine if screen input is valid, then circle back to the screen if something isn’t valid.
- Screen for the user to input some stuff
- Decision Layer 1 to validate each thing on the screen (I recommend one decision, with multiple outcomes for each item to validate)
- This is a SIMPLE decision – we’re looking for “Did we validate Item 1”, “Did we validate item 2”, etc.
- I utilize a formula to count my errors for the screen, then utilize this formula to determine if I need to return to the screen (see #6 below)
- Decision Layer 2 to do the validation for each item
- Here’s where we get complex – we utilize this one to decide what we need to consider Item 1 valid
- If Valid – Hide Error
- If Not Valid – Show Error
- Assignment to mark Item 1 as validated
- ALL outcomes from #3 above should to this assignment
- Return to Decision Layer 1 for each item
- If returning to the screen, Assignment to reset the Validation variables
That’s all for now. Let us know if you’d like to see any of these called out in specific posts.