[SalesForce] Lightning Navigate to Create Record with Default Values not working

I want to add a button on the related list to create a new record with some prepopulated default value in the standard "Name" field. I'm looking at the release notes from Spring 2020 which says it is now supported in Lightning but I'm unable to prepopulate values.

Here is the release notes link: https://releasenotes.docs.salesforce.com/en-us/spring20/release-notes/rn_general_lex_navigate_to_record_dfv.htm

I'm adding a button on a custom object where I want "Name" field to be prepopulated with "Account Name" (where Account is parent). Here is my button URL:

/lightning/o/CustomObject__c/new?defaultFieldValues=
Name={!Account.Name},
Client__c={!Account.Id}

When I add button on the related list on Account Page, I'm still not able to prepopulate Name field. I do not want to hardcode Account Id. What am I missing here?

Best Answer

Remove the line breaks. It's not called out in the release notes and examples always seem to show line breaks (for readability) but line breaks do not work.

/lightning/o/CustomObject__c/new?defaultFieldValues=Name={!Account.Name},Client__c={!Account.Id}}

This is called out in this article, but I've also run into the same issue.

enter image description here

Related Topic