Introducing Flow Base Components

NOTE: The Flow Base Components package has been superseded by the Flow Action BasePack and Flow Screen Component Base Pack. If you’re a developer, use those as your prerequisites. All of the functionality in Flow Base Components is available in the BasePacks.

Many existing older components still use and require the original Flow Base Components. Unless the component you are looking to install specifically states that it requires the Flow Base Packs, you may still need to install the Flow Base Components from the link in the Install section on this page.

As more Flow extensions get built, some components are proving to be popular and reused. To manage this more effectively and minimize conflicts that prevent installation, we’ve created this single base component library. If you want to use one of these components, we recommend that you make this package a dependency and reference the components here. This will help ensure your extension can be easily installed.

There isn’t going to be a managed package version of this because that would put the lightning components into a custom namespace, and lwc doesn’t currently allow lightning components to be used across namespaces

The current components included in Flow Base Components are:

Expression Builder

A full expression builder. Generates formula strings for output, and these can be evaluated at runtime by the Evaluate Formula action, which is part of this package.

Reference

Flow Combobox

This is essential for any custom property editor. It provides a picklist showing upstream merge fields.

Reference

Formula Builder

A full formula builder. Generates formula strings for output, and these can be evaluated at runtime by the Evaluate Formula action, which is part of this package.

Reference

Object and Field Picker

Provides a drop in component for selecting Objects or Object/Field combinations.

Reference

Show Toast

A simple local action that pops a toast up. Works with Screen flows only.

Learn more.

Transfer Metadata

A screen component that can retrieve or deploy any salesforce metadata.

Learn more.

Quick Choice

Learn more here.

Dual ListBox

Learn more here.

Usage Notes

All of the classes and components in this repo have been given a prefix of ‘fbc_’ this looks a little like a namespace but it is not. This is an unlocked package in the c namespace.

For sample code showing how to reference these, take a look at Update Field, a Flow Action that makes extensive use of this base component package. Here are some examples:

Referencing a base screen component

Pay particular note to the mixed use of hyphens and underscores:

Referencing a class method

Referencing methods and components from an lwc

Note the different syntax:

Install

1.3.4 Unlocked

10/4 fixed test bug.

Version Information

1.3.3 Unlocked 10/1 fixes QuickChoice naming conflict

1.3.2 Unlocked 9/26 Adds QuickChoice and DualListBox. Also reduces the size of the MetadataService file to avoid the ‘1 million character’ limit.

1.2.6 Unlocked
9/3/20 – Eric Smith – Updated to Escape and Unescape the {} characters so the metadata string value can be handled by a flow

1.2.5 Unlocked 9/1
9/1/20 – Eric Smith – Added Extracted Metadata String and Escaped Metadata String outputs to the RetrieveMetadata and the TransferMetadata components

1.2.4 bug fixes

1.2.3 bug fixes to Flow Combobox

1.2.2: improvements to Transfer Metadata

In version 1.2.1, Flow Base Components gains:

  • Transfer Metadata
  • Show Toast

Flow Base Components already contains:

  • Expression Builder
  • Formula Builder
  • Flow Combobox
  • Pick Object and Field

View Source

source

Old Versions

1.2.4 Unlocked 8/21

1.2.3 Unlocked 8/5

1.2.2 Unlocked 7/26

1.2.1 Unlocked 7/25

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!

Nick Sauer adds Smart Word Processing Features to Rich Text Input

Input Rich Text has been around for a while. It sports a nice toolbar and allow rich text creation. Nick Sauer has enhanced it with a number of killer new features that add business productivity, including 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.

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

Component Setup:

ParameterIOInformation
enableAdvancedToolsXBoolean. Set to true if you want to use these enhanced rich text features. 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.
valueXXInput and output Rich Text that you’ll be editing
labelXXInput to provide field-level label if desired (label not read only on v1, so left as-is to prevent breaking existing implementations).
characterCount1) 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

Component Input Example:

Installation:

1.3 Unlocked 8/1/20

Resources:

Source

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

Old Versions

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 (currently disabled until Summer ’20), 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 (note: this is temporarily disabled but will be added in Summer ’20)
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