Copy-paste field values with one click

Automatically copy the Expected Revenue value to the Amount field in a deal record—with just the click of a button in your CRM.

In many sales operations, the Expected Revenue field in deal records reflects a more accurate or recently revised figure than the Amount field. Sales teams often need to align these two values, especially when finalizing forecasts or preparing pipeline reports. However, manually updating dozens or even hundreds of records can lead to data-entry errors and wasted effort.

To streamline this process, consider adding a custom button that uses a lightweight Deluge function, so sales reps don't have to copy-paste or retype values between fields. When clicked, the button reads the current Expected Revenue value and automatically updates it into the Amount field on the same record. Interesting? Read on to learn more.

Permissions and availability

  • Users with the Modules Customization permission can create custom buttons.
  • Users with the Manage Extensibility permission can write custom functions.
  • Users with the Manage Sandbox permission can manage the sandbox.

Requirements

  • Create and link the button with the custom function, as detailed in the "Create a button" section below. Learn more
  • Test the function in a sandbox before deploying it in your production environment. Learn more

Create a button

Follow the steps below to create a custom button linked to a function.

  1. Navigate to Setup > Customization > Modules and Fields > Deals > Buttons > Create New Button.
  2. Provide a name for the button. For example: "Copy Exp Revenue to Amount".
    Add a description (optional).
  3. Choose the layouts in which you want the button to be placed.
  4. Specify the button's placement as In Record and its position on the page as Details.
  5. Select the action to be performed as Writing Function.
  6. Provide a name and display name for the function, then click Create.
  7. In the Deluge script editor, do the following:
    1. Copy and paste the code provided below.
    2. Click Edit Arguments.
    3. Enter the name as dealId and select the value as Deals - Deal Id.
    4. Click the + icon to add more arguments.
    5. Enter the name as value and select the value as Deals - Expected Revenue, then click Save.
    6. Save the function.
  8. Turn on button accessibility for CRM Users.
  9. Select the profiles who can view this custom button.
  10. Click Save.

The code

Code Copied
mp = map();
mp.put("Amount",value);
update=zoho.crm.updateRecord("Deals",dealId, mp);
info mp;
info update;
return "Successfully copied";

Notes

  • Make sure to use the accurate API names for their corresponding fields (e.g., "Amount") in the code snippet. Learn more
  • The value argument directly receives the Expected Revenue from the button argument mapping, so no additional API call is needed to fetch the record.
  • The script above is an example of copying the Expected Revenue field's value into the Amount field in a deal record. You can adapt this code to copy-paste field values in any module by modifying the field API names and parameters. For example, you can update a Mobile field with information from the Phone field in the Leads module.

Tips

  • Configure and test the button in a sandbox to ensure that further development doesn't disrupt your production environment.
  • If you need to copy values between other fields within the same record, you can clone this button and modify the field API names in the script accordingly.

Test the solution

  1. Navigate to the Deals module.
  2. Open a deal record that has a value populated in the Expected Revenue field.
  3. On the Deal Details page, click the "Copy Exp Revenue to Amount" button in the top-right corner.
  4. Verify that the button returns the message "Successfully copied".
  5. Refresh the deal record and confirm that the Amount field now reflects the same value as the Expected Revenue field.
  6. Test with a deal record where the Expected Revenue field is empty to confirm that the function clears the Amount field.

Idea

You can automatically copy the information from the Phone field to the Mobile field in the Leads module. If you wish to do so, use the following code snippet.

Code Copied
mp = map();
mp.put("Mobile", input.phone);
update = zoho.crm.updateRecord("Leads",input.leadId.toLong(), mp);
info mp;
info update;
return "Successfully copied";

Note

  • Make sure you add the arguments leadId and phone, and map them to the values Leads - Lead Id and Leads - Phone, respectively.

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 PointCustom Button
  • EditionEnterprise and above
  • ComplexityLow
  • Implementation Time15 minutes

Features used in the solution

Custom ButtonDeluge ScriptSandbox
Story Image

Looking for a custom solution?

Contact us, we will help enhance your productivity at lightning speed.

SUBMIT REQUEST

Developers: Share your solution with our community!