force:createRecord – DefaultFieldValues Not Working with Dependent Picklist

create-recordsdependent-picklistlightning-aura-components

I'm working with force:createRecord trying to pre-populete some field values and everything is working fine except for the dependent picklist I'm filling.

                let createRecordEvent = $A.get("e.force:createRecord");
                params = {
                    "entityApiName": 'Case',
                    "recordTypeId": selectedRecType,
                    "defaultFieldValues": {
                        "Category__c" : "Customers", //controlling field
                        "Subcategory__c" : "Asignation", //dependant field
                    }
                };
                createRecordEvent.setParams(params);
                createRecordEvent.fire();

But this is what I got:

enter image description here

I've checked that this was a known issue back in 2020 but is there now a workaround to accomplish this? Or is still not working?

Regards,

Best Answer

This ability to set default values for dependent picklist values was not brought to Cases, which is why it's not working for you.

You can now prepopulate a record event with default values in dependent picklists. Default values on dependent picklists are available on accounts, opportunities, contacts, leads, and custom objects.

It's not expected to work, currently, for Cases. You'll have to look at using a different mechanism for this if setting a default value is a blocker. A Flow screen could handle setting the default values, but that assumes there's not a large amount of fields on the page layout that you'd have to re-create.

Related Topic