How to do more with Custom Permissions in Salesforce Lightning Flows by Scott McClung

Apex Action to make Custom Permissions even more useful in flows.

  • Detailed write up available here
  • To install the package click here

Apex-Defined Data Types for Salesforce Admins from KatieKodes.com (Tutorial)

Learn how to easily work with complex data types using flows and Apex with Summer ’19’s Apex-defined data types feature, in this admin-focused tutorial with lots of screenshots!

Apex Defined Data Types for Salesforce Admins Tutorial

Use Einstein Next Best Action with Flow by Marc Baizman

Ever wanted to inject Einstein Next Best Action into your Flows? Check out this post by Marc Baizman.

Display a Picklist of Flow Names with the FlowList Control

FlowListFSC is a specialized combo box that you can drop into any flow screen. It displays a list of all of your flows, and can be configured to show just the active ones.

NEW: flowPickerFSC Version 1.3 now offers additional functionality

I built FlowCombo because I’ve been exploring orchestration of multiple flows to solve more advanced business problems. In this prototype I’ve been working on, each of the blue buttons represents a flow that is associated with the current Case status. Click on the button and the flow runs:

In order for this to be useful, it needs to be possible for admins to customize these ‘Case Plans’ to meet their own needs. This is done with a flow called Case Plan Manager, that includes this screen:

When designing the UI above, I was able to use picklists for a couple of the fields, but I didn’t have an easy way to show a list of flows, because flows are metadata, and not records.

To solve this, I’ve built a custom component that is based on the standard lightning combo box. When it initializes, it does an Apex query using the newly available FlowDefinitionView SObject. This did not get put into the release notes, except in a mention here, so it’s a little under the radar. I’ll post more on it later.

FlowListFSC takes the following inputs:

Supported attributes

label – field label;

selectedFlowApiName – if flow is selected, its api name is recorded in this variable, also component can be initialized if value is passed from parent component;

showActiveFlowsOnly(default=false) – if true, shows only active flow components;

required(default=false) – if true, field becomes required and component will throw an error on attempt to navigate to next flow screen;

showWhichFlowTypes(default='Flow,AutolaunchedFlow') – specifies flow types;

Developer Notes

The cmp file for my component passes an object called comboBoxOptionObject. It’s the job of the Apex controller FlowListController to take advantage of a brand-new Summer ’19 api for getting flow information.

The component has to carry out two key pieces of work:

  1. Use its Apex controller to make an SObject query to get the list of flows
  2. Transform the list of flows into the format expected by the base comboBox control.

At initialization time, the component quickly calls the associated apex controller:

Component javascript controller

Here’s the Apex controller. As you can see, all it really does is make a SOQL query and return the results. It also implements the Visualforce ‘special technique’ that’s used to get a SessionId:

The helper code does the work of converting the array of objects that comes back from Apex into the form expected by the combobox base control:

Finally, the component markup invokes the base control and defines the attributes:

And that’s it. Note that there are two other new resources, FlowVersionView and FlowVariableView, which let you drill down for details on a particular Flow or Flow Resource.

Old Versions

How to do more with Custom Permissions in Salesforce Lightning Flows by Scott McClung

https://www.linkedin.com/pulse/how-do-more-custom-permissions-salesforce-lightning-flows-mcclung/

DualListBox Flow Screen Component

This component surfaces the dual listbox in flow screens. It allows for multiple selection and returns the selected values either as a comma-separated list or (more usefully) as a collection of strings that can be looped over.

This is an installable component and is not the same as the built-in Multiselect Picklist, which looks like this:

Dual Listbox expects two key pieces of data:

  1. (required) The full set of all of the items that should appear in the list boxes
  2. (optional) The subset of items representing the ones that are selected (on the right side)

Unlike the Multiselect Picklist, the Dual Listbox does not (yet) directly accept picklist or multiselect picklist field types.

Likewise, you can output the set of selected values as either a comma-separated string or a string collection variable, or both.

If you output the set of selected values as a comma-separated string, you can feed that string variable back into the input to support ‘Previous’ and make sure the selections are remembered when Previous is clicked. At the moment, a bug is preventing Previous support for use cases where you store the selected values in a string collection variable.

You can also:

  • make input required
  • specify the minimum and/or maximum selections allowed by the user
  • set your own help text
  • set the vertical size of the component
  • disable reordering of the selected items

These attributes can be set in the “input” section when adding the component to a screen within a flow.

Datasources

This screen component accepts four kinds of input:

String of comma-separated valuesFor simple cases where there’s no distinction between the label and value
Single collection of stringsFor simple cases where there’s no distinction between the label and value
Two collections of stringsFor cases where you want to display labels but the underlying values are different
a FieldDescriptor data structureAllows you to pair this component with Flow Actions that generate FieldDescriptor data. See below for more information.

Attributes

Dual List Box works with two sets of data:

  • the set of All values
  • the set of values that are selected (on the right)

To provide the set of All Values, specify the input by passing a value to ONLY ONE of the three data input attributes:

  • allOptionsFieldDescriptorList type=”apex://FieldDescriptor[]”
  • allOptionsCSV” type=”String”
  • allOptionsStringCollection type=”String[]”

If you’re using the ‘Two Collections of Strings’ datasource option, you can also specify an input for:

allOptionsStringCollectionLabels type = “String[]”

The attributes representing the Selected values can be provided as inputs (to set existing selections) and taken as outputs. They are:

  • selectedOptionsFieldDescriptorList type=”apex://FieldDescriptor[]”
  • selectedOptionsCSV type=”String”
  • selectedOptionsStringList type=”String[]”

Using the FieldDescriptor Datasource

The FieldDescriptor custom datatype provides a shortcut to populate a dual list box with all of the fields of an object. A common use case: , suppose you’re generating a layout and want to let the user pick which fields from a specified object will get displayed. (Here’s an example) .

To fill a dual list box with field names, place in front of it the GetFieldInformation action, which is included in the dual list box package. You pass in the name of an object (eg. ‘Contact) and it returns a collection field data, including each field’s label and apiName. You can then simply pass that output into the dual list box.

For more information on custom data types like FieldDescriptor, see (https://unofficialsf.com/the-salesforce-automation-and-decisioning-wiki/apex-data/)

When using the Field Descriptor option, you additionally need to tell the dual list box which attributes of the FieldDescriptor data structure should be assigned to the three different dual list box roles:

useWhichObjectKeyForLabelpicks the field that should be displayed in the dual list boxes. Defaults to ‘label’.
useWhichObjectKeyForDatapicks the field that should be used to represent the value of the choice. Usually this is ‘name’.
useWhichObjectKeyForSortpicks the sort order field that should used for the list. Usually this is ‘label’.
useObjectValueAsOutputBoolean. Defaults to True. Specifies which of useWhichObjectKeyForLabel and useWhichObjectKeyForLabel should be output. If this is set to true, the value of useWhichObjectKeyForData will be used.

Developer Notes

This functionality has been implemented in a hierarchy of components. At the center is the standard base dual-listbox lwc component. That component is pretty primitive, however, so we wrap it in extendedBaseDualListbox, which adds the ability to synchronize labels and values. That basically means that you can pass in two sets of values, choose one to display in the list boxes, and output the value from the other one, for each selection. ExtendedBaseDualListBox is not flow aware at all, and can be used in pure coding applications.

The DualListBox control that users interact with calls ExtendedBaseDualListbox. It is where the Flow-centric logic exists, including support for custom property editors and the FieldDescriptor data structure.

Install

DualListBox is part of the Flow Base Packs. Install Flow Screen Components Base Pack and it will show up in your Screen Builder

Older Versions

Source Code

Source

Archives

Video: Warning may have some obsolete information Watch the video.

Displaying Map with markers in Flow screen using Lightning Components by Terence Chiu

UnofficialSF is Looking for Volunteer Editors

UnofficialSF is Looking for Volunteer Editors

Want to help the Flow community, work closely with Salesforce Flow PM’s and build your flow knowledge? Become an UnofficialSF editor. 

The general goal we have is to make this the best starting point for flow knowledge. That means tasks like adding links to the high quality flow content being created by the flowhana, such as Jen Lee’s recent article on Flow with encrypted fields, and Rakesh Gupta’s recent post on Local Actions, searching out new undiscovered flow content, culling out obsolete material, and more. 

UnofficialSF is a WordPress site and pretty easy to work with.

Don’t worry that you’re signing up for a big commit. Think of this more like a pool of volunteers that can choose to take on small tasks and drop out anytime.. 

Interested? Contact aedelstein@salesforce.com