from Chris Emmett: A Great 1 Minute Intro to Loops

Probably destined for the Academy Award for 2020 for Best Flow Short. Check it out!

From Jenn Lee: Use Flow to Create Users and Manage Permission Sets and Permission Set Groups

This solution features a neat use of Custom Metadata Types to store sets of related values for user creation. Check it out!

Add a Rich Text Input Control to your Flow Screens

This Post was most recently updated on:ย 1/11/25


Key Contributors: Nick Sauer, Clifford in Frankfurt

1/11/25: Thanks to Jeroen, this component is now reactive

9/21/24: Thanks to Declan, you can get a more accurate count by excluding HTML

4/16/23: Thanks to Clifford in Frankfurt, this extension now fully supports the ability to enable or suppress specific formats

Input Rich Text sports a nice toolbar and allow rich text creation. It also provides Find and Replace, Autoreplace, and Blocklists. As you can see below, these new features are available via a swanky bottom toolbar, and can be turned on or off as a group. Clifford in Frankfurt has added additional ability to control which features are enabled or suppressed.

Note that this isn’t the only choice you have. Here’s a powerful alternative extension to consider, with a different mix of features.

You can pass in a map of terms that you want to automatically replace.

How it Works:

Use Case Example:  Business has the need  to enter customer-facing details that:

  1. Blocks users from entering certain sensitive words/symbols
  2. Automatically applies Trademarks (โ„ข) or other company-specific terminology.
  3. Allows for Find & Replace tool to correct mistakes

Summary:

IMPORTANT: Use enabledAdvancedTools = true input attribute if you want to leverage these enhanced features. Otherwise leave empty and regular input Rich Text component will be used.

  1. Warn or Block Transition in Flow if disallowed words and/or symbols are present.
  2. Find and Replace
  3. Auto-Replace suggested words
  4. Undo functionality for search/replace or suggested words
  5. Character Count and Max Character limits.

Admin Instructions:

Enabling and Disabling Features in Flow:
  1. Default function is regular rich text input field. To enable advanced features set enableAdvancedTools to true.
  2. Setting label provides a field label for the rich text input.
  3. Rich Text input/output is provided through the value attribute.
Configure the default Rich Text Features in Flow:
  1. By default, all rich text features (called formats) like bold, italic, image etc. are enabled.
  2. Optionally, specify the exact formats you want to allow by providing a comma-separated list with formats to the “Enabled Formats” attribute. Example: bold, image
  3. Optionally, disable certain categories by providing a comma-separated list with categories to the “Disabled Categories” attribute. Example: INSERT_CONTENT, ALIGN_TEXT
  4. The complete list of formats and categories can be accessed in the Input Rich Text documentation on: https://developer.salesforce.com/docs/component-library/bundle/lightning-input-rich-text/documentation
Replace Text with Suggested Terms:
  1. If autoReplaceMap is populated, then a button is shown to user.
  2. Use autoReplaceMap to set up key:value pairs in JSON. Example: {“Test”:”GreatTestโ„ข”} a. When user employs the button, the key will be replace by value.
Managing Disallowed Words and Symbols:
  1. If disallowedSymbols or disallowedWords is filled, then user will be notified while typing one of those words or symbols.
  2. Both disallowedSymbols and disallowedWords accept a comma delimited string.
  3. The default message will say ‘Error’ and provide the violating word/symbol. This will also give validation error if user tries to advance while error is still present.
  4. To change the message to a warning only, and turn off the associated validation (allowing user to advance the Flow), set warnOnly attribute to true.
Character Counts and Limits:
  1. Character count is off by default. Set characterLimit to an integer value to show character count and limit.
  2. If warnOnly is not set when characterLimit is on, then the Flow Next/Finish cannot be used until resolved.
ParameterIOInformation
enabledFormatsXAn optional comma-seperated list of allowed formats. By default, the list is computed based on enabled categories. Example: bold, image
disabledCategoriesXAn optional comma-separated list of button categories to remove from the toolbar. Example: INSERT_CONTENT, ALIGN_TEXT
enableAdvancedToolsXBoolean. Set to true if you want to use enhanced rich text. Default is false (regular input component)
autoReplaceMapXJSON formatted key:value map. (example => {“Test”: “GreatTestโ„ข”} )
disallowedSymbolsXComma-separated list of words to block. Example: /,@,*
disallowedWordsXComma-separated list of words to block. Example: bad,worse,worst
warnOnlyXBoolean. Set to True if you want to allow Next even where disallowed Symbol or Word remains. Default is false.
characterLimitXInteger. Set character limit. This will enable character count and limit, and if warnOnly is not true, then will block next.
valueXXInput and output Rich Text that youโ€™ll be editing
labelXXInput to provide field-level label if desired
excludeHTMLCharacterCountXSet to True if you want to exclude HTML characters in the character count

User Instructions:

  1. While entering text in the Rich Text Area, if you use words or symbols that are flagged as not allowed, you will receive either a warning message or an error message. a. If the warning message is displayed, this is for notification only, and you will be able to proceed. b. If the error message is shown, this means you will need to correct the noted error prior to continuing. If you try to click Next/Finish, a validation message will be given.
  2. To Search and Replace text, click on the magnifying glass icon. titled ‘Search and Replace’ a. A ‘Search Text’ field is displayed where you enter the text you want to find. b. A ‘Replace with Text’ field is shown where you enter the replacement text to be applied where the ‘Search Text’ is found. c. Use the ‘Check’ icon to commit the search/replace. d. Use the ‘Revert Last Change’ button that appears after search/replace to undo the changes just made. e. If you no longer want to use Search/Replace, you can click on the Magnifying Glass icon again to hide these fields.
  3. To replace suggested terms set up by your admin, click on the Merge icon titled ‘Apply Suggested Terms’. Note this will only be shown if your admin has configured this. a. The component will find text to be replaced and overwrite with teh replacement term identified by your admin.
    b. Use the ‘Revert Last Change’ button that appears after search/replace to undo the changes just made.

Component Input Example:

Installation:

1.7 Unlocked 1/11/25 Production Sandbox – Reactivity added

Resources:

Source

Also see https://unofficialsf.com/copy-paste-of-images-in-flow/

Old Versions

1.6 Unlocked 9/21/24 Production Sandbox – Additional support for turning on formats

1.5 Unlocked 4/16/23 Production Sandbox – Additional support for turning on formats

1.4.1 Unlocked 7/3/21 (Production or Dev) 7/3/21 – Eric Smith – Added an * next to the Input Label when the Required attribute is True
1.4.1 Unlocked 6/3/21 (Sandbox)

1.4 Unlocked 6/25/21 (Production or Dev)
1.4 Unlocked 6/25/21 (Sandbox)

6/25/21 โ€“ Eric Smith โ€“ Added a Required attribute and adjusted the bottom margin to better match standard components

1.3 Unlocked 8/1/20

1.0.1

MetadataService: A Useful Base Library for Flow Developers

MetadataService is a subset of Andy Fawcett’s legendary Apex-Mdapi metadata service project, slimmed down and packaged to be useful to Flow Developers as a dependency.

If you’re using these metadata deployment and retrieval services in your own Flow Action or Screen Component, consider simply requiring that this package be installed as a prerequisite

Learn more here.

Installation

V1.0 Unmanaged 7/5/20

Source

source

Developer Memo: Working With Metadata Service

There are some powerful data structures that are currently available only through retrieval and deployment via the metadata API. For example, the Process Builder Converter tool works by first retrieving a process builder process as a piece of flow metadata, then editing the metadata so it can be opened in Flow Builder, and then deploying the modified flow metadata as a new, separate flow.

In general, using metadata deployment and retrieval is the last resort you should use. If your data is accessible via the UI API, the Tooling API, or via a REST interface, those are likely to be preferable. One reason is that metadata deployment may trigger a recompilation of all of the apex classes on your org, and that will pause your deployment until it’s finished. So while metadata deployment will generally go very quickly on developer edition orgs, it might be much slower on a production org. (As a note, you can control whether your metadata deployments trigger a recompilation with this checkbox:

Despite these issues, sometimes Metadata deployment is a great tool to use. The Process Builder example is a good one.

Another example involves creating, editing, and deleting ListViews via a Flow Action. While ListViews can be read via UI API and REST, they can only be created, edited, or deleted by doing metadata deployment of ListView metadata.

How to Incorporate Metadata Deployment and Retrieval

There are two sets of tools you can use to build Flow Actions and Screen Components that use Metadata Deployment and Retrieval.

Method 1: Assembling your Metadata Using Andy’s Objects

The first tool is the legendary Apex Metadata Service created by Andy Fawcett. This abstracts a lot of gnarly SOAP transactions into nice clean API’s. Here’s an example of a Flow Action making use of the Metadata Service to create ListViews:

The reason this works is that MetadataService has gone and created a wrapper class for each piece of Salesforce metadata. In the code above, you can see that we’re able to reference MetadataService.ListView(). Once we have one of the ListView objects, we can simply fill it with updated values, and then call createMetadata on it. There are similar methods for updating, deleting and reading.

You can peruse the vast set of available objects by scrolling through the main class file here.

Method 2: Assembling Your Metadata By Hand

When we went to create the process builder converter, though, we weren’t able to use the above method. The reason is that the current MetadataService only has updated metadata through API version 42, from 2017. We needed to create flow metadata that used brand new additions that had only been added in version 48.0

You can see here, that the Flow definition in Metadata Service (era 2017)…

lacks the brand new metadata element that stores new Flow triggering information:

Hopefully, someone will update the MetadataService to the latest API. In the meantime, you can solve this problem because the MetadataService also provides direct access to lower level deploy and retrieve methods that don’t require you to populate one of the metadata objects.

When you operate at this lower level, you have to directly parse and modify the metadata xml. Then you have to zip it up with base 64 encoding, and then you call MetadataService’s ‘deploy’ method directly. This has been implemented asynchronously, so we carry it out via a Flow screen component called TransferMetadata that can sit there on a flow screen and poll until a response is received.

While this may sound a little intimidating, you can just take and copy the code we used.

Introducing the MetadataService BaseLibrary

To streamline the efforts of developers who want to build tools like Create or Edit ListViews, we’ve packaged the necessary MetadataService files into a useful package that you can just require as a dependency. This package leaves out some extraneous files from the repo but has everything necessary to carry out deployment and retrieval.

In general we’re starting to move towards base libraries to avoid collisions and simplify packaging for new actions and developments.

Install it here.

Create or Update with the new ‘Upsert Records’ Action

Use UpsertRecords when you want to take a collection that may or may not already exist in the database and save it. If the records in the collection have valid Id values, the corresponding records in the database will be updated with the flow’s collection. If not, new records will be created and saved.

UpsertRecords provides functionality similar to the Apex ‘upsert‘ command. You can optionally provide the name of a field on your object that is the externalId and you can specify that you want partial saving to work even if some of the saves fail (‘all or none’).

This functionality is available in the CollectionActions package starting with version 1.19.2

You can provide either a collection or an individual record (and in fact can provide both), but because of a limitation in the action configuration framework, you have to specify both types, even if you’re only using one, like this:

Inputs and Outputs

AttributeType
inputCollectionList<SObject>
inputRecordSObject
externalIdFieldNameString
allOrNoneBoolean

This action currently has an output called ‘placeholder’ that should just be ignored. If an error occurs during the upsert, the error message will be thrown back to the flow

Installation

Install the Collection Actions package, starting with 1.19.2

Video Highlights from June Flow Demos

June was a big month for Flow demo videos. First we had Summer ’20 Release Readiness Live, with special cameos by my mother-in-law’s dog, a baby, and a dubious plant.

A week later, at TrailheaDX, another Flow presentation was given. This one included a sneak preview of two upcoming blockbuster features: Multicolumn Screens and Autolayout Canvas.

Check it out!

Robert Anderson on Handling Defaults in Picklists

This solid post has a nice comparison of standard picklist behavior and QuickChoice behavior.

Check it out!

Create a Next Best Action Employee App – Part 2

Setup and Installation steps (View Part 1 for demo video and details on the building blocks)

STEP 1: Install package

OR


STEP 2: Setup the environment

  • Make sure all custom fields on the User object are accessible and visible in the page layouts
  • Object Manager โ†’User โ†’Fields & Relationships
  • Navigate to each of the fields below and follow the steps to Set Field Level Accessibility to Visible to all profiles
    • Navigate to each of the fields below and follow the steps to Set Field Level Accessibility to Visible to all profiles
      • Einstein HiPo Likelihood
      • Next Shift Start Date
      • Next Shift End Date
      • Is People Manager
      • Survey Taken

Screen Shot 2020-06-25 at 11.43.37 AM.png
  • Ensure that the fields are visible in the default page layout
  • Go to object manager – User page layouts. Drag the custom fields to the Additional Information Section
  • Repeat for Message layout โ†’Drag the Category field appears in the detail page

STEP 3: Create Users of the app.

  • User1
    • First name Bessie
    • Last Name Thomas
    • use your email for email and
    • give a username such as b.thomas@demo51.org
    • In additional information
      • Check Is People Manager
      • Add dates for Next Shift Start and Next Shift End Dates
      • Leave the Survey Taken column unchecked
  • User2 (Important to use the same name as for the purpose of the demo , it is hard coded)
    • First name Rosa
    • Last Name Garcia
    • use your email for email and
    • give a username such as m.garcia@demo51.org
    • In additional information
      • Leave the Is people manager unchecked
      • Leave the Survey Taken column unchecked
      • Give a value >80% to simulate Einstein HiPo Likelihood
      • Add dates for Next Shift Start and Next Shift End Dates
  • Make sure to remember the username and also change the password. (You should receive an email on the registered email)

STEP 4: Assign permissions

  • Go to users – permission set and enable both Goodmorning and Goodmorningsales permission for the user user(user user is the admin user for scratch orgs)
    • Permission set โ†’Manage Assignmentsโ†’ Add Assignmentsโ†’ User, User (if scratch org or the relevant users) .
  • Profilesโ†’system adminโ†’ change permissions to view object (Assuming both users are System Administrators. If not assign the following permission accordingly to the users created)
    • custom app setting โ†’check bright team management
Screen Shot 2020-06-25 at 11.52.01 AM.png



STEP 5: Add Data to custom objects

image
  • Go to SalesTacticalPlan object from the AppMenu (If it does not show – make sure the user permissions are set)
  • Create a record with the details shown (EmployeeDailyTacticalPlan)

  • Create the following records to the Recommendation object
  • If you do not see any field visible on the recommendation object : Go to Recommendation object Managerโ†’Page Layoutโ†’Manage Assignment โ†’Edit Assignment and assign recommendation layout to all users.
 NameDescriptionAction Reference Acceptance LabelRejection Label
1Priority Message: Tax DayTax day is in 6 weeks! Get more detail.Tax_FlowAcceptReject
2Priority Message: Well Being SurveyOur records indicate that you have not taken the Well Being Survey. Please take a few minutes to complete it.Well_Being_Survey_FlowAcceptReject
3Work.com Contact Risk AlertAlert! You have recently come in contact with someone who has tested positive for COVID -19. Please contact the health center for more details.Contact_RiskAcceptReject
4Return to Work Shift Days Shift_FlowAcceptReject
5Training RecommendationYour manager has identified that you will benefit from the Great Salesforce Leaders training. Click to enroll.Enrollment_FlowAcceptReject

STEP 6: Set up the flow component to accept input for which messages and their respective priorities to be surfaced on the NBS Component

  • Navigate to the Bright Team Mgmt App from the App Menand then user profile(click on the profile pic icon) and then edit page to bring up LAB. NOTE: If you click on user profile when on setup , you go to User setup not the profile page so make sure you are on the app when pulling it up
    • Drag the Flow component and choose Manage Employee Tactics as shown below
Screen Shot 2020-06-25 at 11.54.52 AM.png

Drag a flow component.Choose the manage tactical plan. activate it for the org default

  • Go to the Bright Team Mgmt app and then user profile(click on the profile pic icon) and then edit page to bring up Lightning App Builder โ€” if clicking on user profile when on setup pulls up

Screen Shot 2020-06-17 at 1.17.21 PM.png
Also set component visibility , add filter, Save and Activate.

  • Go back to user profile and the flow component displays –
    • Click Manage the team Priorities

Screen Shot 2020-06-25 at 12.18.16 PM.png
[If the following error message displays then do this additional step below]

This step maybe required on a non-scratch org - go to Setup - My Domain โ†’Register a domain โ†’Login โ†’Deploy to users.


Screen Shot 2020-06-17 at 1.23.00 PM.png

Once done go back to UserProfile

  • Click Manage the team Priorities
Screen Shot 2020-06-17 at 1.20.59 PM.png
Order priorities(these are passed in from the flow) - these are all messages that are available. 
Once ordered - it gets saved on the EmployeeDailyTacticalPlan record as shown below
Screen Shot 2020-06-17 at 1.21.22 PM.png

STEP 7: Set up the NBA component (This is another flow component with a custom LWC -NOT THE STANDARD NBA COMPONENT)

We use a custom component here to show the modularity of the strategy builder. This demo can also be built with the standard NBA component and that is not covered here.

Screen Shot 2020-06-17 at 1.33.53 PM.png
  • Navigate to the user profile page again and edit page.
  • Add another flow component (which acts as the NBA component )
  • Choose โ€˜DemoFlow_GetRecommendationsWithFlowActionโ€™ Flow
  • Click on the Pass Record id
  • Enter the strategy name- EmployeeTacticalStrategy (In the NBA component record id is passed automatically)

Set component visibility so it is viewed by the second user


STEP 8: Login and test the component

  • Login to the first user page : Bessie smith – Set the priorities. (If already covered in the steps above, login as the second user)
  • Now login to the second user page : See that the recommendations are displayed
Screen Shot 2020-06-18 at 11.34.12 AM.png


Create A Next Best Action Employee App- Part 1

Employee experience is the new HR superpower. Customer experience is no longer only for customers, with the Salesforce Platform you can not only seamlessly create amazing digital experiences for employees but also deliver them personalized and optimized. Especially in light of the new โ€˜work anywhereโ€™ normal that fused home and work life, digital employee experience plays a key role in not just productivity but also employee motivation.

On this employee experienced focussed app, Einstein NBA can be leveraged to deliver

  • Education and event participation opportunities
  • Personalized communication
  • Well being and motivation opportunities

and much more. Powered with the insights from Einstein prediction builder – NBA combines data, business rules and AI to provide relevant and real time individualized recommendations.
Note: Prediction builder is not integrated in the app below but simulated with prediction scores.

Use Lightning flows with NBA

This app also showcases how Lightning flows can be used in conjunction with Next Best Action. There are numerous applications of how flow and NBA can be integrated into apps for powerful outcomes such as the one in this example. The example also shows a custom LWC component to display Recommendations and not the standard display component -this illustrates the modularity of the strategy builder and how it can be used with a custom component because it is exposed as a service.

A great way to combine the power of Apex with business user configuration

This sample application uses a sophisticated pattern to provide team managers with a simple flow that they can use for prioritization, while enabling IT to add or subtract recommendation tactics behind the scenes. This is a powerful way to address the desire of customers to mix backend power with business user configuration.

The individual tactics are modeled as Apex classes. The same example can be extended for several use cases of how system integrators can use Next Best Action to provide increased value by making use of Apex to create tooling that team managers can use to cater to the specific use case.

Building blocks of the app

(View setup and installation steps in Part-2 of the blog)

Untitled presentation (1).jpg

Untitled presentation (2).jpg
Untitled presentation (3).jpg
Untitled presentation (4).jpg

See part 2 for setup and installation steps