Get Old Owner of zoho crm record

Get Old Owner of zoho crm record

Hello Team

Sample code:- 
  1. Getrecord = invokeurl
  2. [
  3. url: "https://www.zohoapis.com/crm/v5/Leads/"+Lead_ID+"/__timeline"
  4. type: GET
  5. connection: "zcrm"
  6. ];
  7. if(Getrecord.get("__timeline").size() > 0)
  8. {
  9. for each rec in Getrecord.get("__timeline")
  10.     {
  11. if(rec.get("field_history") != null && rec.get("field_history").getJSON("api_name") == "Owner")
  12. {
  13. OwnerNew = rec.get("field_history").getJSON("_value").getJSON("new");
  14. OwnerOld = rec.get("field_history").getJSON("_value").getJSON("old");
  15. //..........here apply the user Api and get the owner ID..........
  16. }
  17.     }
  18. }
here in the Lead_ID you have to just pass the record lead id and new owner and old owner will be there

Thanks & Regards
Piyush Goyal
Zoho Developer || 3+ years Experience
+91- 8619164837