patrickjust3k

changing blueprint stages

Aug 24th, 2023
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. //gather general details
  2. potentialDetails = zoho.crm.getRecordById("Pipeline",potentialId);
  3. followup = potentialDetails.get("FollowUp_Schedule");
  4. info "followup Schedule: " + followup;
  5. type = potentialDetails.get("Type");
  6. info "type: " + type;
  7. potentialOwnerId = potentialDetails.get("Owner").get("id");
  8. info "deal owner id: " + potentialOwnerId;
  9. personId = potentialDetails.get("Person").get("id");
  10. info "contact id: " + personId;
  11. // find associated transition
  12. blueprint = invokeurl
  13. [
  14. url :"https://www.zohoapis.com/crm/v2/Pipeline/" + potentialId + "/actions/blueprint"
  15. type :GET
  16. connection:"crm_all"
  17. ];
  18. info "blueprint: " + blueprint;
  19. transitions = blueprint.get("blueprint").get("transitions");
  20. info "Transitions: " + transitions;
  21. info "followup Schedule: " + followup;
  22. for each transition in transitions
  23. {
  24. transitionName = transition.get("name");
  25. info "transition name: " + transitionName;
  26. if(transitionName == followup)
  27. {
  28. transitionId = transition.get("id");
  29. }
  30. }
  31. info "transition id: " + transitionId;
  32. //put new transition into record
  33. if(!transitionId.isNull())
  34. {
  35. dataMap = Map();
  36. dataMap.put("Notes","Updated via deluge");
  37. blueprint1 = Map();
  38. blueprint1.put("transition_id",transitionId);
  39. blueprint1.put("data",dataMap);
  40. blueprintList = List();
  41. blueprintList.add(blueprint1);
  42. param = Map();
  43. param.put("blueprint",blueprintList);
  44. response = invokeurl
  45. [
  46. url :"https://www.zohoapis.com/crm/v2/Pipeline/" + potentialId + "/actions/blueprint"
  47. type :PUT
  48. parameters:param.toString()
  49. connection:"crm_all"
  50. ];
  51. info response;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment