Navigate to a Record’s Create Page with Default Field Values using encodeDefaultFieldValues in LWC

This example launches a contact record’s new page with prepopulated default values from account view page.

This example HTML includes the link to create a contact from account record page.

To encode the default field values into a string, pass them to encodeDefaultFieldValues(). Assign the encoded string to the state.defaultFieldValues property in the page reference.

In this example , we set the AccountId,FirstName,LastName,Email & Phone as default values.

Enable the Lightning web component only for account record page 

No comments:

Post a Comment