Record Owner details inside a record

Lot of factors lead to a winning deal. Besides the obvious of being the first of the vendors to reach out to a prospect and closely following up without overwhelming the potential customer, and arranging for timely presale support, the processes followed internally either add to or slow down the efficiency. One such internal process is for the sales manager to have visibility into the details of who is following up on a particular prospect. Let's assume the sales manager gets a call from a prospect. You'd appreciate having all the information on the sales person who is following up on the sale as well. This visibility empowers the sales manager to engage with the prospect with more clarity. Be it an escalation or an usual query from the prospect, the call ends more fruitfully.

Here's a function that makes your job easier by, letting you add the lead owner information to the lead record using custom fields. Now, when you report you can classify them based on the sales person who handled the lead or the profiles(Designations e.g. Administrators, Standard).

The capabilities of this function does not stop here. The goal is to fetch the employee details and add them to records in modules to indicate the record owner. For companies with a huge sales team, sometimes panning across products or branches, this function comes handy.

Getting started with the function

  1. Go to Setup > Customization > Modules > Deals > Links and Buttons > + New Button.
  2. Provide a name for the button. For example: "Create Quote from deal". Add a description(optional).
  3. Select the placement of the button as View Page.
  4. Select the action to be performed as "Writing Function".
  5. Copy the code given below.
  6. Click "Edit Arguments".
  7. Enter the name as "leadId" and select the value as "Record ID".
  8. Enter the name as "ownerid" and select the value as "Record Owner ID".
  9. Click Save & Execute Script.
  10. Save the changes.
  11. Select the profiles who can view this button.
  12. Click Save.

The Code

headerMap = {"Authorization":"555289a90fb486ea702236e516ac87b2"}; 
response = invokeurl 
url :"" +ownerid 
type :GET 
//info response; 
uservalue = response.get("users").toJSONList(); 
for each rec in uservalue 
city = ifnull(rec.get("city"),""); 
state = ifnull(rec.get("state"),""); 
country = ifnull(rec.get("country"),""); 
email = ifnull(rec.get("email"),""); 
phone = ifnull(rec.get("phone"),""); 
name = ifnull(rec.get("full_name"),""); 
mp = Map(); 
update = zoho.crm.update("Leads",leadId.toLong(),mp); 
info mp; 
info update; 
return "success";



  • The code is zoho.crm._getRecordById for Version 1.0 of.
  • Change the 'xxxxxxxxxxxxxxxxx' with your crm authtoken.
  • The above code can be used in conjunction with different functions. For example: It can be used together with the lead assignment function so that the record owner information is added as soon as the lead gets assigned.
  • To use this code in other modules, change the module name from "Leads" to the required module name.
  • This code adds the name, phone number and email id of the record owner in the custom field. Do create the required custom fields and try it out. The custom fields can also be added as a separate section if required.
  • To fetch other user details, do tweak the code and add the relevant custom fields.

Found this useful? Try it out and let me 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