Flow Screen Component: Dependent Picklists with RecordType and MultiSelect Picklist support

Howdy folks! 😀

UPDATE: Feb 2022

I built a new(and better version of this component). I’d recommend you to use the new one.

In winter’19 release, the awesome flow product team released a flow screen component to support dependent picklist in flows. But sadly, this component didn’t support picklist value selection based on the record type. So, I came up with a Flow Screen Component: Dependent picklists based on RecordType selection. You’re welcome to check it out. 😀

But, there is always a but, guess what? That was still not enough.

Huh, why? That’s because we missed everybody’s favorite, the MultiSelect picklists(I hope, you got the joke. If not, contact Steve Molis!). So, basically neither of the components(Salesforce’s and mine) support a multiselect picklist as a dependent picklist.
So, it’s time we give an upgrade to this component.

In this article, I will be sharing the functional details of the component that I built to add the multiselect picklist support to the component, and how you can use it as an Admin or Dev.

So unlike in my previous post on dependent picklist component, I decided to keep it simple. So good news is I have bundled everything into an unmanaged package, which you can directly install into your Sandbox or Production. No fuss!

Link: https://login.salesforce.com/packaging/installPackage.apexp?p0=04t6F000001os6c

Note: I have tested the component quite well, but there is always a still. So you may run into some handled exceptions. In case you do, feel free to reach out, I will try to resolve the issue as soon as possible.

Lights, Camera and Demo!

Please note that the demo picklist values are also rendering based on the record type selection.

Hope you find it useful enough! 😀

Thank you for being an awesome reader! Subscribe to this blog for receiving all the latest updates straight to your inbox. 🙂

87 thoughts on “Flow Screen Component: Dependent Picklists with RecordType and MultiSelect Picklist support

  1. Pingback: Flow Screen Component: Dependent Picklists with RecordType and MultiSelect Picklist support by Narender Singh – UnofficialSF

  2. Hi Nerender,
    I just started using this component, which is GREAT and very needed. The one issue I am having is that if I pre-populate the RecordTypeId, I don’t get any values in the picklists. Is there a way to work around this?
    Thanks,
    John Eichsteadt

    Like

      • Hi Narender!

        It looks like John didn’t respond, but I can. I am working on a flow for our software service team to use in creating new cases. They only have access to two kinds of record types…software & internal helpdesk. For the sake of their customer case intake flow, they should ALWAYS choose software. In this case, I want to force them to only have Software as an option for the flow. Yes, they can click & select Software, but it’s really just extra clicking that I don’t want them to bother with. If the record type could be configured as a default/constant in the flow, that would be awesome.

        Like

      • The thing is if I add this functionality, the component will relatively get slower. But still I would give this one a try since it’s being asked for a lot.

        Like

  3. Narender, this is great! Do you have any guidance for how to use the “Selected Controlling Picklist Value” field? Ideally I would set a default value for it, but I’m having trouble getting it to work (I have tried typing in a text value and using a choice variable, but neither work). Thanks!

    Like

    • Hi Amy,
      The “Selected Controlling Picklist Value” is the that you will select in your controlling field picklist. So in order to get the selected value, you first create a text type variable, and then in the “Store Output values” section of component configuration, set the “Selected Controlling Picklist Value” field with the text variable.
      I am hope I am not sounding confusing. Let me know if that answers your question. 🙂

      Like

      • Thanks…. I don’t think I asked the question correctly, sorry! What I am looking for is to set a default input value for the controlling field picklist. Meaning, when the user gets to the screen with your component, the Controlling value is pre-populated based on their response to a question earlier in the flow. Then they simply select the Dependent values. Just curious if that’s possible. I hope I’m making sense! Let me know if I can clarify further.

        Like

      • Ahh, I see! Well, I intentionally made the component that way, where the user cannot pre-populate the controlling value. I wanted to keep it simple. Maybe in future I can give this an upgrade with some features.

        Like

  4. Hi! Love the web component, I’ve just released it to my organization, and it seems like Only the system admins are able to use it properly.
    If another individual selects a record type from the drop down menu, the component hangs and is unresponsive. Is there a permission I need to provide my users? Their profiles are set to have access to these record types.
    Any help would be appreciated! Thank you!

    Like

  5. Thanks for the excellent component. It almost works great for me, but there is a hurdle I am having trouble overcoming.

    One of my controlling picklist values is “Alerting & Mobile.” This is being retrieved & displayed by the component as “Alerting & Mobile.” Because this value does not match the actual picklist value, it is kicking out an error when that value is selected in the flow.

    Any thoughts about how to overcome this without removing that “&” from the picklist value (the business owner wants it there)?

    Cheers!

    Like

  6. Hi! Awesome flow component! It’s so close to solving my use case! However, I need to be able to set the RecordTypeId without allowing the user to select it or see it on the screen. As it appears others have done before me, if I set the “Selected Record Type Id” with a variable that holds the record type id of the record type assigned to the user running the flow it shows me blank picklists. I see you possibly have had the idea to do this, did you ever get a chance to look into it? This would be awesome!

    Like

      • If you have time that would be an awesome addition to this, I saw a few other solutions out there that could potentially help with this that I will be testing today. Thanks for the quick response!

        Liked by 1 person

  7. I’ve been looking for a component like this for a while. This is great thank you! The only feedback I had was similar to Eric’s. I’m setting a default value for the Record Type Id which is then resulting in blank values for my picklists. I am required to change the record type in order for the picklist values to render. If it could render on load when a default was added that would be amazing.

    Thanks again for this awesome component!

    Like

    • Hey Mike,
      Really appreciate your feedback. This feature has been requested a lot of users. Unfortunately, I haven’t been able to put some time together to refactor the code. Will keep you guys posted on any further updates on this. 🙂

      Liked by 1 person

  8. Hi! I installed the unmanaged package, after I configure this component and test, as soon as I pick a record type, the page spinner comes up, and page freezes. Am I missing any configuration? I added values in the following fields: Object Api Name, Controlling Picklist API Name, Dependent API Name

    Like

  9. Hi, thanks a lot for your component, this is helpful.
    I use it without having record types, but the default value is not selected by default in the controlling picklist.
    I just added in the option tag:
    selected=”{!cp == v.selectedControllingPicklistValue}”
    to get the default value of the controlling picklist and it works fine.

    Like

  10. Hi! Thanks for this, it’s awesome. I saw a few people ask and I’m wondering if you could direct me on what I would need to do in order to limit the record types that display in the picklist? We have multiple record types for cases but only 2 that are relevant to the Customer Support team, so I’d like them to only be able to view these 2 in the flow.

    I can fumble through some Apex but I’m definitely a beginner so any direction/help you can offer would be awesome. Thank you!

    Like

  11. Hi, thanks a lot for this awesome component.
    It seems that we can’t store the API Name of a picklist value instead of it’s label.
    Can you confirm ?
    Thanks

    Liked by 1 person

  12. Hi Narender,
    Thank you for this amazing post! I am exploring how to use dependent pick lists so I am trying get this simple following thing working. I m choosing pick-list selection and dependent pick list selection and then in the next display screen trying to display my selections but it doesnt work!
    I am exploring if I need to use “Manually assign variables (advanced)
    Store Output Values to Select Variables” wondering how do I do it? Any thoughts please?

    Like

    • Should be pretty straight forward. For manually assigning values, you should create three text type variables and then use these variables in ‘Selected Controlling Picklist Value’, ‘Selected Depedent Picklist Value’ and ‘Selected RecordType Id’ outputs.

      Like

  13. Looks great – I hope you’re able to add ability to auto-populate the recordtype. We NEVER want our users to select the record type; we always set recordtype automatically in our code. So without auto-populating it, I can’t use this; but I look forward to trying it out once you add this feature.

    Like

  14. Hi, Does anyone know a way to create multiple dependant picklist with a single master in Flow?
    You can do this ina SObject quite easily but i cannot replicate it in Flow without duplicating the OOTB Dependant Picklist Screen Component

    Like

    • A simpler but ugly way would be to use validation rule in screen component to restrict picklist value selection.

      For a more elegant solution, you would need a lightning component to reproduce dependent picklist functionality.

      Like

      • Was worried you’d say that! I’m not that much of a coder! I’m sure your code could be used as a base if someone else wanted to take up the challenge!

        Like

  15. Guidance on how to get the component to work would be helpful. I have tried everything I can think of and yet when I run the flow it just spins and spins and spins . . .

    Like

    • @Robin – did you figure this out? We’re using the component (it’s amazing ForcePanda! Thank you for sharing), and it works perfectly on desktop, but when someone attempts to use the flow on mobile, it just spins and spins after the record type is selected.

      Like

  16. Hi Nads. I installed your dependent picklist component, but it looks like this can only handle a controlling picklist and one dependent. Is that correct? I need two dependents off of the controlling field, so I may have to take a different approach. Any suggestions?

    Like

    • Hi Andrew,

      That’s correct. My component only works with a pair of controlling and dependent.
      To address your request, I can’t think of any simpler way but to build a custom lightning component.

      Like

  17. Thanks for the component. Glad I found it. I am also trying to prefill the controlling picklist value but the fix of LaureC (selected={!cp == v.selectedControllingPicklistValue}) works, but the dependent multipicklist is not filled onLoad. And with my little coding knowledge I am not able to make the code work to call the handleControllingPicklistChange() function from the doInit() method in case a prefilled value is provided. Anyone able to help?

    Like

  18. Hi, thanks for your work on this and for being so responsive to folks. I installed this in a SB and it is also spinning for me in Chrome/FF/Safari. I can see the picklists behind the spinner, but it never resolves. I know you’ve advised people to run debug logs. I’m not a dev, but I have attempted to do this. I think this may be relevant: 15:41:54.0 (27520133)|FATAL_ERROR|System.NullPointerException: Attempt to de-reference a null object
    Happy to share more if you have the time to help with this. It may be I have set it up wrong.

    Like

  19. Additional information: if some of you saw the “spinner” icon when the screen was trying to pull the component. Make sure you have granted the Apex Class Access and Visualforce Page Access to the Profiles.
    – Apex Class Access: DependntPicklistCMPwithRecTypeAndMspCtrl
    – Apex Class Access: DPicklistCMPwithRTAndMSPCalloutMock
    – Visualforce Page Access: SessionIdPage

    Thank you Narender for replying my email so fast! It works perfect~

    Like

      • Hi thank you for responding. i checked the debug log and saw this error . Malformed JSON: Expected ‘{‘ at the beginning of object. please take note that were using this on a community site. its working properly on the flow screen debug but is not rendering on the community site. I also added the implement forceCommunity:availableForAllPageTypes but still not working. hoping for your help

        Like

      • Hmm… Can’t think of anything at the top off my head. Needs a bit more digging.
        My calendar is a bit stuffed for this month unfortunately to look into this. 😦

        Like

  20. im also having this error on line 75 of the apex class. here is the system debug DEBUG|response.getBody[{“message”:”Session expired or invalid”,”errorCode”:”INVALID_SESSION_ID”}]

    Like

    • Ahh, fish!
      Honestly, this component needs some rework since it’s an aura component. The implementation with LWC would be so much simpler. Unfortunately, I don’t really have the time for it at the moment.

      Like

  21. Thanks for sharing! I’m trying to troubleshoot this error message “INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST: State: bad value for restricted picklist field: Arizona.”The flow is failing regardless of which state (option), Should I be passing the picklist value API names instead?

    Like

  22. Hello, I am running into same error of Malformed JSON: Expected ‘{‘ at the beginning of object. This has been working thus far, but we are seeing this error now. We are using this internally in a screen flow and all appropriate access to the Fields and Recordtypes have been granted. I have digged a lot on this , but don’t see any apparent reason why it is unable to fetch the details. Any suggestion would be much appreciated as we are in kind of rut because of the failures.

    Like

  23. Hello, We have used this component in screen flow but now need to make controlling and dependent picklist fields required. Not able to find any way to do this. Can you please confirm if this is possible?
    Thanks for your help.

    Like

  24. HI,
    This component is working great in debug mode in the flow builder, but after I select the record type, it just spins when attempting to pull in the other fields, ‘type’ and ‘subtype’. What am I missing?

    Like

      • Hello,
        Thank you for your quick reply. Below I have 2 few more questions ( very sorry if you have already answered above, but i juste wanted to make sure 🙂 )

        – I understand that it is not possible to auto-populate the recordtypeID ? When I do so, the controlling field becomes blank
        – Is it possible to auto populate values in the controlling field ?

        My use case will be for the user to only select values in the dependent picklist without having to click through record type and the controlling field.

        Thank you for your reply , and great component !

        Caroline

        Like

      • Hi,

        This component doesn’t support default values. It’s possible to code it in the logic but unfortunately I don’t have enough capacity to work on it in my free time. 😄

        Like

  25. Hola,
    Buenas tardes, muchas gracias por tu componente, ha sido de gran ayuda con el componente de dependientes.
    habrá forma de incluir que la dependencia sea controlado por 4 campos. me explico tener lo siguiente:
    campo1
    campo2 1(Dependiente de campo 1 y controlador del campo 3)
    campo3 (Dependiente de campo 2 y controlador del campo 4)
    campo4 (Dependiente de campo 3)picklist

    Like

  26. Great stuff! We are currently looking into the oft-requested “Limit Record types” so if you have any ideas… We are thinking a comma-separated list of record types, but who knows. We also plan on making the record type label configurable, we do not want to ask “Record Type” for the first us, we need to ask ” What kind of request do you want to make” hardcoding works fine but we want to keep this usable in many places.

    Like

  27. Pingback: Flow Screen Component: Dependent Picklist with Record Types support version 2 |  forcePanda

  28. Hi Nads. This is an awesome LWC. Already put it to good use with our Field Service implementation. It works great but every so often a use might get the following error
    The Lightning Component c:dependentPicklistWithRecordTypeID generated invalid output for field recordTypeId. If the user logins to SF in a different browser then it works fine. Other users in the same browser are not having issues. Any ideas? Thanks

    Like

  29. Hello i’m testing this app and works perfectly in a developer free environment, but when I try it in a customer environment (Sandbox or Production) doesn’t work, is block with the Spinner and cannot select anything from the picklist.

    Thank you.

    Like

Leave a comment

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