Tracking refunds and adjusting the sales executive's revenue in Zoho CRM

Business scenario:

Having a clear refund policy goes a long way in gaining customer trust. Depending upon the line of business, the refund window might vary. This is even more important in the case of online purchases where customers get to see and feel the product only after making the purchase.

The Deals module in CRM helps track the revenue associated with the sales executives. By taking a report of all the 'won' businesses pertaining to a month, you'll be able to calculate the revenue associated with the sales executives concerned. Recently one of our users asked if there is any working solution to track refunds. Typically, the refund period is 30 days and the refunds have to be tracked without affecting the revenue numbers from the preceding month. Hence updating the closed Deal stage to a "Refunded" stage won't work.

A simple solution to this problem is to clone the won deal that needs to be refunded and make the following updates in the cloned deal:

  • Update the deal value in negative to account for the refund amount.
  • Update the deal closing date to current date.
  • Update the status of the cloned deal to "Refunded".

This leaves the revenue numbers of the preceding months and the sales forecast for the current month intact while accounting for the refunds too. Expecting your sales executives do all these steps manually is a tall order. Fret not, the Function I'm sharing this week helps you do all these steps at the click of a button.


  • Create a Deal Status named "Refunded".

Getting started with the function:

  1. Go to Setup > Customization > Modules and Fields > Select the required module > Links and Buttons > + New Button.
  2. Provide a name for the button. Add a description(optional).
  3. Choose View Page from the drop-down list.
  4. Select Writing Function from the subsequent drop-down.
  5. Provide a name for the function. Add a description(optional).
  6. Copy the code given below.
  7. Click Edit Arguments.
  8. Enter the name as dealId and select the value as Deal Id.
  9. Save the changes.
  10. Select the profiles who can see this button.
  11. Click Save.

The Code:

dealDetails = zoho.crm.getRecordById("Deals", input.dealId.toLong());
create=zoho.crm.create("Deals", mp);
info mp;
info create;
return "success";

Before refund


After refund



  • The above code works only for API V2.0 and not the previous version.

Found this useful? Try it out and let us know how it works! If you have questions, do not hesitate to ask! Share this with your team if you find it useful!

Return to Tips