Check out the new addition to unofficialsf.com!

We have been posting about great things you can do with Flow and do in Lighting for quite some time now. When you click on Flow from the Home Page and then look at what is available to Extend Flows, you get to view and select from a number of different Flow Screen Components, Flow Actions and Process Components. We also have selections for Next Best Action, Lightning Page Components and External Services.

What was missing was a place to show you some of the great Applications and Utilities that you, the Administrator, can download and use to help you develop in and support your own orgs. Check out this new section often to see what might be there that you can put to use. Let us know in the comments about other Apps and Utilities that you would like to see highlighted on this page.

What to do when you have trouble updating a component

Many of the components on this site get updated on a regular basis with new enhancements. All you should need to do is follow the installation instructions to bring the component version up to date in your own orgs. Unfortunately, the methods and versions of the packaging tools we’ve used to produce these updated releases have changed over time. Things have finally settled down a bit and we are trying to be much more consistent in how the updates get packaged.

If you do run into issues there are a few things you can try. Unofficialsf.com contributor, Jack Pond, wrote this article a while back that may do the trick for you.

Another possible issue pops up when you have already created Flows that use the component you are trying to upgrade. Here’s an error you might see when trying to upgrade from v2.0 of the QuickChoice component:

This means you will have to Uninstall the current version before you can re-Install the new version. That’s OK if you haven’t already created Flows that use the component. What happens then is that you might get a message like this, “Unable to uninstall package” followed by one or more “Component is in use by another component in your organization. My_Flowname“.

If you are seeing this, you will need to first Delete any Flows that already use the component you are trying to update. Rather than having to recreate them from scratch, you can temporarily Export them then Import them back in after you have installed the updated component. Do this by first installing my Import/Export Flow Utility Flow.

Import and Export Flows between Salesforce Orgs

The Import/Export Utility works with the most recent or active version of the Flow. You might also find that you have a number of older, inactive versions of the Flow that you have to delete as well. This can be a time-consuming manual process that can be avoided if you install my Flow and Process Builder List View with Batch Delete App.

Flow and Process Builder List View with Batch Delete

It will be a fairly painless process once you have the right helper utilities installed in your org.

  1. Export your affected Flows
  2. Delete the inactive versions of the Flows
  3. Uninstall the old Component
  4. Install the new Component
  5. Import your saved Flows

The Definitive Guide to Managing Access for Guest User Accounts

There have been a lot of changes to what you have to do to let Guest Flows read and write data. Here’s a guide:

Check it out!

From ProvenWorks: A Replacement Address Component With All Sorts of Smart Verification

One thing I really like to see: Flow Components with price tags. That typically means customer support and solid, deep functionality. A recently available ‘pro’ component for your consideration: AddressTools from ProvenWorks. They already had a potent lightning component that checks the validity of addresses. They’ve now exposed that functionality via two new Flow Screen Components:

Check it Out!

Winter ’21 Preview from AccidentalCoder: Use Before Delete Triggers To Clear Out Related Records So Your Delete Will Work

A really nice use case from Vibhor Goel: he pointed out that the common situation where a delete is prevented by related records can be addressed with a Before Delete flow like this one:

Check it out!

DetectAndLaunch v1.1 : Launch _Screen_ Flows Modally when Records are Edited or Deleted

DetectAndLaunch has been updated to include an option to launch screen flows modally. It also has the ability to launch different flows depending on whether the record has been edited or deleted.

More info and installation here.

Import and Export Flows between Salesforce Orgs

Import and Export Flows between Salesforce Orgs

Created by Eric Smith


This Post was most recently updated on: 3/21/23
Current Version: 2.0.2

3/21/23 โ€“ Eric Smith โ€“ Version 2.0.2
Uses the BasePack version of the Flow Picker instead of the stand-alone version

3/18/23 โ€“ Eric Smith โ€“ Version 2.0.1
Updated to use the current versions of the Flow Base Packs
Intallation updated to use Unlocked Package links


Have you ever wanted to copy or move a Flow or Process Builder from one org to another without having to create a Change Set or rebuild it from scratch?

How about seeing a great Flow that you or someone else has created and would like to share?

Install this Flow in your org if you would like to Export or Import Flows and Process Builders.

Instructions

Export a Flow

  1. Select SetupProcess AutomationFlows
  2. Open Import/Export Flows
  3. Run the Flow
  4. Select Export, choose your Flow and click Next
  5. You will see the export status while the Flow is being transferred
  6. A success message will display once the Flow has been exported
  7. The exported Flow is saved as a Salesforce File linked to your User record.  To see your Files, click on the Waffle, type in Files and select Files.
  8. To download and save your Flow file so it can be shared, select the drop-down arrow and choose Download.

Import a Flow

  1. Select SetupProcess AutomationFlows
  2. Select Import/Export Flows
  3. Run the Flow
  4. Select Import then click on Upload Files
  5. Pick the Flow file from your computerโ€™s file dialog box.  Hint: The file names for Flows and Process Builders will end with .flow-meta.xml
  6. After the file has been uploaded, select Done then click Next
  7. You will see the status while the Flow is being imported and then deployed to the current org
  8. A success message will display once the Flow has been imported and deployed

NOTE: Objects, fields and referenced components must be available and compatible in the new org in order for the Flow to be deployed successfully.


Installation

Step 1

This component requires that you first install or upgrade the Flow Base Packs

Step 2

This component also requires that you first install or upgrade the Flow List Picker Version 1.5.0 or later

Step 3

Install the Flow Import/Export package

Production or Developerย Version 2.0.2
Sandboxย Version 2.0.2

Step 4

Because this component uses Metadata APIs, youโ€™ll need to have a Remote Site Setting in the org. If you donโ€™t, youโ€™ll see an error like this the first time you try to Import or Export a Flow.

You will need to configure your org to essentially allow applications to run that call out to the internet and then back into the same org via its API endpoints.

The best way to get the correct endpoint is to force the error.

  1. Select SetupProcess AutomationFlows
  2. Open Import/Export Flows
  3. Run the Flow
  4. Select Export, choose your Flow and click Next

If you do not have the correct Remote Site Setting yet, the Flow will display the โ€œUnauthorized endpointโ€ error.  Copy the endpoint url listed in the error message as you will need it in the next few steps.

In Setup, type remote, select Remote Site Settings and click New Remote Site.

Give the Remote Site a name, paste in the url you copied from the error message and click Save.

Thatโ€™s it.  The App is ready to go!


Source Code

Source Code


Release Notes:

3/21/23 – Eric Smith – Version 2.0.2
Uses the BasePack version of the Flow Picker instead of the stand-alone version

Production or Developerย Version 2.0.1
Sandboxย Version 2.0.1

3/18/23 – Eric Smith – Version 2.0.1
Refactored to use the latest Flow Base Packs
Intallation updated to use Unlocked Package links

1/2/21 – Eric Smith – Version 1.2
Refactored the Flow to use the Flow Base Packs

9/3/20 – Eric Smith โ€“ Version 1.1
Updated the Flow Base Components (v1.2.6) to resolve an issue where some Flows would generate an error on Import or Export

9/1/20 โ€“ Eric Smith โ€“ Version 1.0
Initial Release

Create, Delete, or Update Tens of Thousands of records at a time in Flow with the new Mass Transactor Action!

Ladies and gentlemen, I present to you what might be one of my favorite new actions: The Mass Transactor Action!

We at CapTech Consulting looked for the most impactful action for both our clients and the community, and decided it would be extremely powerful to enable Flow to run Creations, Updates, and Deletes of records asynchronously – AND specify a batch size.

Using this new invocable you will be able to transact records with little concern for limits – so long as you set your batch size correctly. Batch processing is specifically designed for large volumes of transactions – think of it as a ‘set it and forget it’ method of doing DML in Salesforce.

This action has been shown to create well over 10,000 records in a single Flow. That same flow, carrying out standard synchronous Create Record, failed at 300 records. That represents an increase of more than 33 times the transactional capacity of a typical DML action in Flow!

What’s ‘Asynchronous’?

tl;dr (too long, didnt read) version: Async processing increases your limits. Use it when you want to do stuff to a lot of stuff and you don’t care exactly when the stuff gets done.

Most of what you work with in Salesforce are synchronous transactions. That means that when you do something to trigger the transaction, you will need wait until the operation is done. Asynchronous transactions work the opposite way: you send it off into the dark and hope everything works out okay. You can still determine if it succeeded, but it will take a little more work by querying the AsyncApexJob object using the outputted JobId.

I heavily recommend this Trailhead on Asynchronous processing (promise it isn’t bad): https://trailhead.salesforce.com/en/content/learn/modules/asynchronous_apex/async_apex_introduction

How it Works

  1. Pass this action a collection of records you want to create, update, or delete
  2. Decide if you want to change the default Batch Size, which is 200. This means that Salesforce will bucket 200 records into a transaction. If you want to process 5,000 records and your batch size is 200, Salesforce will effectively create 25 separate transactions for you – all with doubled SOQL/CPU limits! For ‘busy’ objects with a ton of code or automation, you’ll want to lower this if you have issues at 200.
  3. Run the flow
  4. If you want to track the progress of your operation, make note of the returned JobID, and use it at the Apex Jobs page in Setup or do a Get/Lookup in flow using the provided Job ID on the AsyncApexJob object and show the returned Job record’s fields on a screen for the user.

Major Features of the Invocable

  • Create, Update, or Delete a record collection asynchronously from Flow and double your governor limits
  • Creates a Batch job that lets you monitor its progress from the Apex Jobs setup page or lets you query the AsyncApexJob object using the output’d JobID. You can then display the status on a flow screen using results from a ‘Get’ on the AsyncApexJob object using the JobID as your identifier:

Real World Walkthrough

Stay tuned for a walkthrough of how this could be used to process THOUSANDS of records.

Batch Management & Notes

  • Use in Triggers / Processes – Be very careful when using this in any process builder launched flows, triggers, or after-update flows. Batch jobs are not meant to be triggered hundreds of times.
  • Batch Size – If your input collection is 2,000 records and your batch size is 500, it will create 4 batches. Each batch is considered a transaction to Salesforce. If in doubt, leave the batch size input blank – it will default to 200.
  • Batch Size Management –  Lower the batch size number if you have a lot of of code/automations and you need to ensure you dont hit Apex Limits. The only way of truly knowing the safe number is by testing – 200 is a great starting point. Keep in mind a lower number will mean the job will take longer complete, but will ensure you don’t hit limits.
  • For Creates – Getting the record Ids created by the job is not currently possible from within Flow without some extra work.
  • Job Limits – An org can only have but so many batches going at once – your job will be queued and/or put in the ‘Apex Flex Queue’ for processing – https://developer.salesforce.com/docs/atlas.en-us.224.0.apexcode.meta/apexcode/apex_batch_interface.htm
  • Empty / Null Checks – Ensure you’re doing a null/empty check on whatever collection you pass in before running the action! There’s no use creating empty jobs to clog up the Apex Jobs list.

Inputs

  • Operation Type (Text) Valid options are Create, Update, or Delete
  • Input Collection (Record Collection) Can be any sObject/Record collection from Flow
    • Note that if you want to Update or Delete records, an Id will need to be present in the collection. It doesn’t support specifying an External Id. Yet.
  • Batch Size (Optional) (Number) Specify how many records you want Salesforce to process at once.
    • Ranges from 1 – 2000. Default is 200.
    • THERE IS A MAX OF 2,000 RECORDS PER BATCH! This is a Salesforce imposed limit and this will throw an error if you try and go above it.
    • This is where the magic happens – lower this number if you have a ton of code/automations and you need to ensure you don’t hit Apex Limits.
  • Finish Notification Email Address (Optional) (Text) A single email address to send the finish email to
  • Body of the email (Optional) (Text) What the email will contain upon completion
  • Subject of the email (Optional) (Text) Subject of the email upon completion

Outputs

Download / Source

NOTE: Keep in mind this is an UNMANAGED package, which means it cannot be upgraded in the future. I would suggest installing in a sandbox and deploying the apex classes together when migrating to production.

Unmanaged package (contains 4 Apex Classes): https://test.salesforce.com/packaging/installPackage.apexp?p0=04t3h000004m6N7

Unlocked Package Links:

production: https://login.salesforce.com/packaging/installPackage.apexp?p0=04t3h000004m6NHAAY

sandbox: https://test.salesforce.com/packaging/installPackage.apexp?p0=04t3h000004m6NHAAY

Source:

Now available in the FlowComponents repo at: https://github.com/alexed1/LightningFlowComponents/tree/master/flow_action_components/MassTransactor

and at https://blogs.va-comer.net/git/mbcomer68/mass-transactor-action/src/branch/master/force-app/main/default/classes

Future Improvement Ideas

  • We’d love to build in more details about the success of the Job – potentially tying this with a custom platform event that will output a string of IDs created or an event that a Flow can listen for and act on.
  • Provide for a success/failure email using either an email template ID or a flow text template
  • Building in Upsert functionality
  • Create a separate action that allows you to cancel a job if needed
  • Provide a SOQL query to do your Update/Delete – this is handy if your collection exceeds the SOQL limit of 50,000 records.

Carry out Advanced Flow Scheduling with DateMatcher

The DateMatcher action lets you achieve more precise scheduling of your Schedule-triggered Flows, enabling you to run Flows that activate on ‘the third Wednesday each month’ or the ‘the 23rd of August, each year’.

Here’s how you configure it:

Note the use of a Custom Property Editor.

The action compares the current date/time to the configuration you’ve provided, and simply returns a true or false based on whether the current day is a match. So the way to use Date Matcher is to create a Schedule-Triggered flow that triggers every day, and then have it always run DateMatcher to see if the current day matches your criteria:

Install

Version 1.0.0 Unlocked 8/30/20

View Source

source

Launch Screen Flows Automatically When a Record Changes with ‘Detect and Launch’ Page Component

This Post was most recently updated on 1/14/23
Credits: Derek Camp from GearsCRM : we can now pass the recordId to the Flow

Credits: Andy Haas for adding conditionality and proper support for the onLoad event.


Suppose you have a screen flow that you want to automatically launch whenever you’re on a record page and the record changes. Most likely, this will be because the user just edited the record. As an example, suppose you want to make it so that every time a Case is edited and its priority changes, a screen flow runs that asks the user to provide some extra reasons if the priority has been raised to ‘High’.

This new DetectAndLaunch component makes this easier. It’s designed to sit invisibly on a page and listen for an event that gets fired by Salesforce when a record changes. Simply provide Detect and Launch with the name of the flow you’d like to run. It will load the flow into a subtab if the app is in console mode, and a separate browser tab or page if the app is not in console mode.

Launch Conditions

By default, the flow will launch on every change to the record. However, you can refine that and make the launch dependent on a particular field value change. Example: you need an agent to fill in specific details when they close a case or your sales reps need to send a quote to the customer you can launch a flow after a specific field has changed and, for example, is equal to true. See ‘Conditional Screen Flow Launch Based on a field edit’, below.

You can set the record to run a screen flow on an Edit, a Delete, or every time the record is loaded.

Demos

This demo was produced for V2.0 and shows Conditional Launch Based on a Field Edit:

Triggering a screen flow when a record page loads

Perform this with the new input field โ€˜Flow Name (when the record is loaded)โ€™. You can use this to launch the flow when the record is opened. Note that if you are using Launch Mode = Modal, you will need to build a close function within the flow, as the modal doesn’t have a close function, yet.

Conditional Screen Flow Launch Based on a new Field Value

Let’s say you have a case record that you want to launch a flow when the case is closed to get the user to enter the amount of time that they spent on the case. To configure this within Detect and Launch, enter the flow name you want in โ€˜Flow Name ( when the record is edited )โ€™, set Change Field to โ€˜Statusโ€™, and set Change Value to โ€˜Closedโ€™. 

Want to check multiple fields and launch different flows based on them? Or run different flows depending on the value of the field? Add multiple Detect and Launches with different criteria to launch different flows.

Example Configuration

Limitations

This component uses the force:recordData component and that component doesn’t support all Salesforce standard objects. For example, the Event and Task objects are not supported. For a list of supported objects, see the User Interface API Developer Guide.

Inputs

Flow Name (when Record is edited)editFlowNameThe apiName of a flow you want to launch when the record is updated. Will work if this component is added to a record home page.
Flow Name (when Record is deleted)deleteFlowNameThe apiName of a flow you want to launch when the record is deleted. Will work if this component is added to a record home page.
Launch ModelaunchModeCan be ‘Modal’ or ‘Modeless’. Modeless is the default. Modal only works on an edit and not on a delete.
Change Field (What Field To Watch For)Change FieldIs used to signify what field you want to watch when a record has been edited. Used only with editFlowName
Change Value (What value are we looking for)Change ValueUsed to be the comparison value when the record has been edited. 
Flow Name (When Record is Loaded)Flow Name (when the record is Loaded)Use this to launch the flow when the record is opened.

Install

V2.2.1 : 2-8-23 Production Sandbox Bug fixes

Source

source

Old Versions

V2.2 : 1-14-23 Production Sandbox Properly supports the Load event

V2.1 1-12-23 Production Sandbox Properly handles boolean (checkbox) fields

Version 2.0 Production Sandbox 9-10-22 Conditional Field-based Launching

Version 1.2.1 Unlocked – 7/9/21 – Derek Camp, GearsCRM
Passes the recordId value to the Flow

Version 1.2 Unlocked 12/26/20
Changes referenced field name from Subject to Id

Version 1.1 Unlocked 9-6-20

Version 1.0.0 Unlocked 8-29-20