3

I met a question when i create a new action about create a quote with lightning component. i use e.force:createRecord to display the creation page, and use defaultFieldValues to predefined some field values, most of fileds can be predefined except BillingStateCode and ShippingStateCode. Although BillingCountryCode is already predefined, BillingStateCode is still null. So does it a limitation or i missed something?

1

So finally got an answer, but unfortunately you're not gonna like it.

This is the expected behavior with dependent picklists, both programmaticaly and declaratively: You can set default values for controlling fields but not for dependent picklists.

This is part of the Dependent Picklist limitations available here.

There is an existing idea you can vote for to enable Default Picklist Values on Dependent Picklists, but I don't think you'll be able to do more than that.

0

Have you activated State and Country/Territory Picklists ?

If yes, you should be able to define a value for BillingCountryCode and BillingStateCode, assuming that the BillingStateCode is a valid value for the selected BillingCountryCode. You can find more information about the relationship between these 2 fields here.

If State and Country/Territory Picklists are not activated, you should use the API Names BillingState and BillingCountry as defined here.

  • Hi Fabien. Thanks for your kindly answer. State and country/Territory picklists has been activated in my org. And i used BillingStateCode filed. I just copy the BillingCountryCode field and BillingStateCode field from Account to Quote. Just like the standard function in classic. But it worked in BillingCountryCode field but not on BillingStateCode Field. Do you have any other idea? Thanks. – user46252 Jun 21 '17 at 1:59
  • So I made another test, and it seems that this is not working for dependent picklist. Created 2 picklists with dependency just to test, and the dependent one isn't populated. – Fabien Taillon Jun 21 '17 at 8:28
  • I've posted a question on the Partner Community, let's see if we get some feedback :) – Fabien Taillon Jun 21 '17 at 8:40
  • Thank you very much Fabien, i thought it maybe caused by dependent pick list. I will search more about this. – user46252 Jun 22 '17 at 1:26
0

Child fields aren't getting populated when creating a new record in LEX when they are controller/dependent fields.

This idea has been submitted to SFDC - please up-vote:

https://success.salesforce.com/ideaView?id=0873A0000003dpsQAA

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.