When cloning a deal record, it is helpful to have a feature that empties unnecessary field values. This is handy when dealing with similar information to an existing deal record. Additionally, automatically updating the field values on the cloned record ensures that the new deal includes all the necessary information. These automated actions allow salespeople to concentrate on the most critical aspects of the deal rather than sifting through unnecessary data.
Although your CRM allows for the cloning of deals, it does not come with the option of field-level automations as a default feature. However, you can write a client script to smoothly execute these automations on your browsers whenever you clone a deal. This script can empty or update any number of field values as needed.
Permissions and availability
- Users with the Manage Extensibility permission can create client scripts.
- Users with the Manage Sandbox permission can manage the sandbox.
Requirements
- Create a client script that triggers on the clone page of the deals module. Learn more
- Test the function in a sandbox environment before deploying it to your production environment. Learn more
Add a client script
- Navigate to Setup > Developer Hub > Client Script > +New Script.
- Provide a name for the script. For example: "Update deal fields while cloning".
- Add a description (optional).
- In the Page Details section, do the following:
- Category - Choose Module.
- Page - Choose Clone Page.
- Module - Choose Deals.
- Choose the layout. It can be Standard or any other custom layout of the deals module.
- In the Event Details section, do the following:
- Type - Choose Page Event
- Event - Choose onLoad.
- Click Next.
The Client Script IDE will open. - Copy and paste the script provided below.
You can customize the script, if needed. - Click Save and Close to save the client script.
The code
//Add the fields to be emptied when a user clones a deal
var dealName = ZDK.Page.getField("Deal_Name").setValue("");
var accountName = ZDK.Page.getField("Account_Name").setValue("");
var contactName = ZDK.Page.getField("Contact_Name").setValue("");
var closingDate = ZDK.Page.getField("Closing_Date").setValue("");
//Add the fields to be updated when a user clones a deal
var probability = ZDK.Page.getField("Probability").setValue("10");
var stage = ZDK.Page.getField("Stage").setValue("Qualification");
//Enter the message to be displayed to users on first cloning the page
ZDK.Client.showAlert("NOTE: Some fields have been emptied/updated with new field values.");
Notes
- Make sure you update the script with the accurate API name of their corresponding fields. Learn more
- The above script is an example of emptying and updating field values in the Deals module. You can use this code for any other module by changing the field name and parameters.
Tip
- Configure and test the function in a sandbox to ensure that further development doesn't disrupt your production environment.
Test the solution
- Click the Deals tab.
- Open a deal record you wish to clone.
- On the Deal Details page, click Clone.
- In the Clone Deal page, check whether the deal fields were updated as specified in the script.
- Modify the required details and click Save.
Did you find this useful? Try it out and let us know how it works. Share this with your team if they'd benefit from it! If you have questions, please don't hesitate to contact us.
More info
- ModuleDeals
- Trigger PointBrowser
- EditionEnterprise and above
- ComplexityLow
- Implementation Time15 minutes

Looking for a custom solution?
Contact us, we will help enhance your productivity at lightning speed.
SUBMIT REQUEST