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. 🙂
Pingback: Flow Screen Component: Dependent Picklists with RecordType and MultiSelect Picklist support by Narender Singh – UnofficialSF
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
LikeLike
I have built the component built that way intentionally. Can you tell me why do you want to pre-populate the RecordType field
LikeLike
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.
LikeLike
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.
LikeLike
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!
LikeLike
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. 🙂
LikeLike
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.
LikeLike
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.
LikeLike
Ok – thanks for the quick response!
LikeLike
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!
LikeLike
Have you granted access to the apex classes that being used by the component?
LikeLike
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!
LikeLike
Welp, looks like your web code “corrected” the errant picklist value I was trying to show lol. I’ll display it with hypens so you can see what I mean. “Alerting &-a-m-p-; Mobile”
LikeLike
I will have to check this one.
LikeLike
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!
LikeLike
For your use case, I will have to do quite a bit of refactoring because the present component doesn’t support adding a default value for the Record Type picklist.
LikeLike
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!
LikeLiked by 1 person
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!
LikeLike
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. 🙂
LikeLiked by 1 person
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
LikeLike
That’s unexpected. It’s hard to say why it is happening. You can try to setup debug logs and see what’s happening in the logs. That should give you an idea about what’s going on.
LikeLike
Same thing is happening to me. Did you find a resolution?
LikeLike
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.
LikeLike
Glad you found it useful! 🙂
LikeLike
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!
LikeLike
Hi,
In the Apex controller, you can add an additional filter in if condition where I’m looping over all the RecordTypeInfos.
LikeLike
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
LikeLiked by 1 person
Hi Oliver,
Yes, you’re right. This component only returns the label of the picklist fields.
LikeLike
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?
LikeLike
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.
LikeLike
wow and again wow, thanks for such a useful component
LikeLike
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.
LikeLike
It’s gonna take quite a bit of effort to get that done. 😅
LikeLike
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
LikeLike
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.
LikeLike
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!
LikeLike
My component is slightly heavy in terms of the code and all but now there is a much simpler way to do this in code.
LikeLike
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 . . .
LikeLike
Have you tried looking at the debug logs?
LikeLike
@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.
LikeLike
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?
LikeLike
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.
LikeLike
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?
LikeLike
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.
LikeLike
Hey Jess,
I can spare some time this weekend and have a look into it if you can do a screen share.
LikeLike
That would be super, thanks so much! How should we coordinate?
LikeLike
Can you drop me an email via the ‘Contact Us’ page?
LikeLike
did you have any updates on this case. im experincing this on community site
LikeLike
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~
LikeLike
Amazing!
Thank you, Melody! 😀
LikeLike
its not working for me. its stuck on the spinner even if i gave it access to apex class and vf page
LikeLike
Can you check console log or debug logs and see if there is an error?
LikeLike
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
LikeLike
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. 😦
LikeLike
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”}]
LikeLike
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.
LikeLike
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?
LikeLike
Yes, I think so. When State and Country picklist is enabled, it’s best to pass the code of the State(or Country).
LikeLike
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.
LikeLike
It’s hard to say anything from this error. It’d probably need a bit more debugging.
LikeLike
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.
LikeLike
Making the inputs required and validating them in the component is quite an effort.
Ref: https://forcepanda.wordpress.com/2019/07/09/how-to-validate-custom-flow-screen-components-in-flows-part-1/
The best approach with minimal effort would be to check the value in a decision element and if blank navigate back the screen and show a message using display text conditionally.
LikeLike
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?
LikeLike
It’s hard to say what can be the issue. Can you check the debug logs?
LikeLike
Hello,
I would like to install the package in my sandbox, could you advice how I may do this ?
Thank you
Caroline
LikeLike
Instead of login.salesforce.com use test.salesforce.com in the package link. 🙂
LikeLike
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
LikeLike
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. 😄
LikeLike
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
LikeLike
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.
LikeLike
What you’re asking is quite specific but definitely doable. You’d need a developer to do it for you though unless you already are one(or have one in the team). 🙂
LikeLike
We have one and have made the updates, works like a champ! Still need to add to the test class, only at 93% right now, but works very well, thanks for laying the ground work
LikeLike
Amazing! Thanks for kind update 🙂
LikeLike
Pingback: Flow Screen Component: Dependent Picklist with Record Types support version 2 | forcePanda
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
LikeLike
Hey,
I created a new upgraded component with an additional feature. I’d recommend using that.
https://forcepanda.wordpress.com/2022/02/15/flow-screen-component-dependent-picklist-with-record-types-support-version-2/
LikeLike
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.
LikeLike
Try using this instead because it has some added features.
https://forcepanda.wordpress.com/2022/02/15/flow-screen-component-dependent-picklist-with-record-types-support-version-2/
LikeLike
Hi,
Thanks for LWC. Is it possible to display the multiselect picklist in checkboxes rather than dual list box.
LikeLike
Not in this component. However, it’s possible to adjust the code and tailor it for your needs. Requires a bit of effort though.
LikeLike
Thought as much, thanks.
LikeLike
Hi, Is there plans to upgrade this feature to enable pre-populating the controlling and dependent value?
Thanks
LikeLike
There is already a new version.
https://wp.me/p9MWGI-O5
LikeLike
Can we add a default value to the controlling field in this component
LikeLike
https://forcepanda.wordpress.com/2022/02/15/flow-screen-component-dependent-picklist-with-record-types-support-version-2/
LikeLike
Actually, the problem is Opportunity Product doesn’t have a Record Type and I want pre-populate the value for my product name field
LikeLike