Salesforce allows users to create a record by making a copy of a similar record using its Clone action. When cloning a record which has address, email or phone fields which have been validated by EDQ components the associated EDQ Log records need to be cloned too. This ensures the cloned record also displays the validation status of those fields. To support this, our application offers a Lightning Web Component which can be used in a custom action.
As an example, here are the steps for adding the custom clone action to the Contact object.
Make sure the Edit button for Contact has been overridden with the EDQ Lightning component as detailed on the New and Edit button override page.
Within Object Manager for Contact select Buttons, Links and Actions from the left menu.
Click New Action in the top right.
Provide the following mandatory details and then click Save:
Field | Specification |
---|---|
Action Type | Lightning Web Component |
Lightning Web Component | TExperianLEDQ:ledqCmpCloneBtn |
Label | A label for the button chosen by the user |
Name | A unique API name for the button chosen by the user |
Return to Object Manager for Contact and select Page Layouts from the left menu.
Select your chosen layout, for example Contact Layout.
From the Contact Layout panel at the top select Mobile & Lightning Actions.
Drag the action you created in the earlier step to the desired position in the Salesforce Mobile and Lightning Experience Actions section beneath.
Click Save at the top.
If you now browse to a Contact record you will find the new action button in the top right.
The custom clone action differs from the default Salesforce clone button. The default behavior is to display an edit modal for the cloned record prior to creating it. Instead, our custom clone action first asks for confirmation before going ahead and cloning the record along with any validation statuses.
Once the clone has been created, a confirmation message is shown which allows the user to navigate to and view the cloned record where they can make any necessary edits.