function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Francisco MansoFrancisco Manso 

Custom button missing a default field value

Hey guys

I've created a custom button to create a case from an opportunity in lightning version (I already had onde on classic)
The problem is when I set up the default field values:

/lightning/o/Case/new?
RecordTypeId=012D00000006XjXIAU&defaultFieldValues=AccountId={!IF(ISBLANK(Opportunity.Billing_Account__c),Opportunity.Account, Opportunity.Billing_Account__c)},Type=Provisioning,Business_unit__c=SaphetyDoc,Priority=S3 - Alta,Status=Open,Origin=Internal,Subject={!Opportunity.Name}+MCH OnBoarding_+{!Account.Country_Code__c}+{!Account.NIF__c},SuppliedEmail={!Opportunity.Email__c},Opportunity__c={!Opportunity.Id},Related_Project_Account__c={!IF(ISBLANK(Opportunity.Billing_Account__c),Opportunity.Account,Opportunity.Billing_Account__c)}

and the field business unit is not filled at all. I already check the record types on cases, and the option is there. More weird is the fact that the button on classic version works perfectly. I've attached a picture to see what is the output

Thank you!User-added image

Salesforce TechieSalesforce Techie

You have record types enabled for the obj . Each record type has its own Default. You have to set the default under each record type. 
Go to Setup -> Object Manager -> object -> Record Types -> Open Record Type - Not Edit -> Picklist value to set default
 
Francisco MansoFrancisco Manso
Salesforce Techie it did not work
Francisco MansoFrancisco Manso
but thank you!