From Spring'20 onwards you can create the custom URL button with default field values.
you can define the default values while launches the custom button or custom link or custom code to create a new record with prepopulated field values.
Sample Code
Note: The URLENCODE function works only when creating custom buttons and links. You can’t use it for custom fields.
Demo
Create a new opportunity from the account detail page with populate account values and some of the prepopulated filled values in new opportunity creation form.
Step:1
Step: 2
add the button to the account page layout and click on the new opportunity button.
Output
Note:
Demo Sample:
Refereence
https://releasenotes.docs.salesforce.com/en-us/spring20/release-notes/rn_general_lex_navigate_to_record_dfv.htm
you can define the default values while launches the custom button or custom link or custom code to create a new record with prepopulated field values.
Sample Code
/lightning/o/Account/new?defaultFieldValues= Name={!URLENCODE(Account.Name)}, OwnerId={!Account.OwnerId}, AccountNumber={!Account.AccountNumber}, NumberOfEmployees=35000, CustomCheckbox__c={!IF(Account.SomeCheckbox__c, true, false)}
Note: The URLENCODE function works only when creating custom buttons and links. You can’t use it for custom fields.
Demo
Create a new opportunity from the account detail page with populate account values and some of the prepopulated filled values in new opportunity creation form.
Step:1
Step: 2
add the button to the account page layout and click on the new opportunity button.
Output
Note:
- The URLENCODE function works only when creating custom buttons and links. You can’t use it for custom fields.
- URL Hack working only in New Record and not in the Edit forms
Demo Sample:
/lightning/o/Opportunity/new?defaultFieldValues= Name={!URLENCODE(Account.Name)}, OwnerId={!Account.OwnerId}, Days_To_Close__c=30, TotalOpportunityQuantity=2, NextStep=Call%20to%20customer, Type=New%20Customer
Refereence
https://releasenotes.docs.salesforce.com/en-us/spring20/release-notes/rn_general_lex_navigate_to_record_dfv.htm
I have tried the similar code for creating new case with default values. The button is a list view button, but it did is not working as expected. Can anyone help me with this. code I used: /lightning/o/Case/new?defaultFieldValues= Subject=New%20Customer
ReplyDelete