Here is a simple wrapper function to Tag a CRM record for you to use.

Here is a simple wrapper function to Tag a CRM record for you to use.

I sometimes need to conditionally tag a record when debugging my Deluge code. Here is a simple "wrapper'-style function, that saves a few lines of code (which makes long chunks of code easier to read).



  1. tag1 = Map();
  2. tag1.put("name",tag_name);
  3. tags_list = List();
  4. tags_list.add(tag1);
  5. param = Map();
  6. param.put("tags",tags_list);
  7. recordIDs = List();
  8. recordIDs.add(record_id);
  9. param.put("ids",recordIDs);
  10. res = invokeurl
  11. [
  12. url :"https://www.zohoapis.com/crm/v3/" + module_name + "/actions/add_tags"
  13. type :POST
  14. parameters:param.toString()
  15. connection:"crm_modules_all"
  16. ];
  17. return res;

Call the function this way:
  1. standalone.Tag_Record("Deals",deal_id, "Sample Tag Text");
I use this often enough that "saving" 17 lines of code is helpful to me in preserving maintainability.