Update Quote Stage after an email is sent from Quote Module

Update Quote Stage after an email is sent from Quote Module

After reading multiple posts over the last 10 years that say this cannot be done, I'm not sure if this has been addressed yet? But I figured I'd add how I am achieving this.

Workflow created for Module 'Emails (subject starts with 'QUOTE-' or whatever your quote number naming convention allows).

Then Workflow fires a custom Function to parse the Quote Number out of the email Subject line, query to get the ID of that Quote, then update the stage of that Quote (triggering other workflows which update the deal stage in this case).   I hope this Helps someone.  If I'm making this task too complicated, someone please let me know.  This seems like a simple and common task that many would need that I couldn't find a solution for.


  1. qNo = eSub.left(11);
  2. qNo = qNo.replaceAllIgnoreCase(" ","");
  3. info qNo;
  4. queryMapQ = Map();
  5. queryMapQ.put("select_query","select id, Quote_No from Quotes where ( Quote_No = '" + qNo + "' )");
  6. respQ = invokeurl
  7. [
  8. url :"https://www.zohoapis.com/crm/v5/coql"
  9. type :POST
  10. parameters:queryMapQ.toString()
  11. connection:"zcrm"
  12. ];
  13. info respQ;

  14. respData = ifnull(respQ.get("data"),"");
  15. qid = ifnull(respData.getJson("id"),"");
  16. info qid;

  17. respQ2 = zoho.crm.getRecordById("Quotes",qid);
  18. curQuoteStage = ifnull(respQ2.get("Quote_Stage"),"");
  19. if(curQuoteStage = "Draft")
  20. {
  21. mpQ = Map();
  22. mpQ.put("Quote_Stage","Quote Sent");
  23. updateQ = zoho.crm.updateRecord("Quotes",qid,mpQ,{"trigger":{"workflow"}});
  24. info updateQ;
  25. }