In Automation, Flow, Wizard's Apprentice

Wizard Apprentice – Update Only User Selected Records From a Multi-Select List in Flow

One of the big frustrations people have with Flow is having users select records is a royal pain. There’s no “Lookup” field for a flow screen and searching for records can be messy and inconsistent. Unless you’re prepared to create a custom Lightning Component to embed into a Flow Screen, you’re almost out of luck.

There’s is a way if you’re able to provide a way to limit the possible records.

In this video, I show how you can provide a multi-select field displaying multiple records and then update only the records the user selects. It involves a few tricks and it works best when the potential list of records is small. In my example, the Flow is designed to list records related to a single account.

Pieces of the Flow

Here’s are the elements in the Flow:

  • Screen – With a multi-select for users to select records
  • Fast Lookup – To lookup the records the user might select
  • Loop – To loop through the sObject Collection from the Fast Lookup
  • Decision Element – Determine if the individual record being looped was selected
  • Screens – 1 to show a record not selected, 1 to ask for the user to input the value to update the selected record
  • Assignment – To assign the user input to the sObject Variable
  • Assignment – To add to a new sObject Collection for updating records
  • Fast Update – Update all the in the update sObject Collection

Behind the Scenes

  • Dynamic Choice – Contains list of records for users to choose from. These are the choices of the multi-select field on the first screen
  • variable: recordId – input variable to grab the ID of the record when used in a Flow Action
  • variable: vrAccountID – variable for the Account ID, default value is recordId
  • sObject Collection Variable: vrSoColAssets – Assets in the Fast Lookup. The records should mirror the records in the dynamic choice
  • Sobject Variable: vrSoAsset – A single asset record for the loop.
  • sObject Collection Variable: vrSoColUpdate – a collection variable to hold vrSoAssets that are going to be updated
  • Multi-Select Checkboxes Field: Select_Assets – this is the field on the first screen that uses the dynamic choice
  • variable: vrSelectedAssetsIDs – Text Variable which the value is Select_Assets
  • Outcome: Selected – This is from the decision element. To determine if a specific record was elected we check to see if vrSelectedAssetIDs contains vrSoAsset.id

 

Wizard Apprentice Flow Tutorial

How would you use this Flow trick? Do you know of a better way of accomplishing this without writing code? Let me know!

Want to see more videos on Flow? Let me know in the comments what you want to see!

Don’t miss a post! Sign up to receive email notications.

Subscribe

Subscribe to our mailing list

* indicates required
I want to receive email notifications about:

I run this site, the podcast, and my training videos for the community. I do incur some costs. I greatly appreciate if you can help me out by checking out my affiliates and – if you shop amazon – start your search on my site.

Recommended Posts
Showing 9 comments
  • Paula
    Reply

    Brian,

    I don’t know how you figured this out, but it’s brilliant! Thank you for posting this. I’ve spend hours and hours looking thru documentation, websites, videos etc. I was at the point of thinking is wouldn’t be possible. Even the official documentation states: “When the dynamic choice is used in a multi-select choice field, flow variables store the field values of only the last selected record in the dynamically generated set of choices.”

    Your’s is the only resource that I can find that actually solves this challenge. I would never have come up with this approach.

    • Brian Kwong
      Reply

      Paula,

      I”m glad you found the post and you found it useful. Thank you so much for the kind feedback.

  • Bob
    Reply

    Hello Brian,

    This is really cool! I’ve been looking for something like this forever. I tried recreated UPDATE ONLY USER SELECTED RECORDS FROM A MULTI-SELECT LIST IN FLOW, but It’s not working properly. It allows me to select check boxes but when i click next it just goes to the end of the flow. Do you have step by step instructions on how to recreate this flow? I’m trying to use it on opportunities with a custom object.

    • Brian Kwong
      Reply

      Bob,

      How much detail are you looking for? I have all the individual items listed in the post and the video walks through the flow as well.

      One thing I like to do when things aren’t going the way I expect them to is to add a screen for debugging at the various steps I’m concerned. You could add a screen after the fast update to see what your variables are set as. Other important places you can add some debug information is after each screen and assignment to make sure things are being set correctly. Putting one before the loop will also let you check to see if your fast lookup is pulling the records as expected.

  • Bob
    Reply

    Brian,

    When i run debug in from the flow designer the fast lookup receives the following message. I will try add screens for debugging to see what I get for information.

    FAST LOOKUP: Get_All_Products_from_Opportunity
    Find all Yushin_Product__c records where:
    Opportunity__c Equals {!varOpportunityId} (0063900000r08zy)
    Assign those records to {!scvYushinProducts}.
    Save these field values in the variable: Id, Price__c, Name
    Result
    Failed to find records.

    • Brian Kwong
      Reply

      How are you passing the opportunity Id into the flow? You could try using the 18 character ID. Also just double check that the opportunity has yushin products records and the running user has permission to view the object and record (I’m assuming your an Admin so you should see everything)

  • Bob
    Reply

    I have a custom lookup field on the yushin product object. So my fast lookup is Opportunity__c = varOpportunityId with data type = text, Input/Output Type = input and output and no default value.

    • Brian Kwong
      Reply

      How are you setting the value for varopportunityid?

  • Bob
    Reply

    Hi Brian I fixed fast lookup and I’m getting the check boxes now to select the product. I ran the debug and it gave me the following message and the flow also skips right to my last screen.

    DECISION: Is_Product_Selected
    Skipped this outcome because its conditions weren’t met: Selected
    Outcome conditions:
    {!vrSoProduct.Id} (a0618000004dYq9AAE) Contains {!drcgetprodrecords} (null)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Start typing and press Enter to search