INVALID_TOKEN message when associating project to a deal

INVALID_TOKEN message when associating project to a deal

Hi

Please can someone assist with this issue I am encountering using this Deluge script in Zoho One?

This script successfully creates a new project in the projects module when a deal is won in CRM. 

However the second part of the script is to associate newly created project back to the won deal in CRM but this fails with INVALID_TOKEN message.

The OAuth connection used by the script has the following scopes assigned:

ZohoCRM.modules.ALL

ZohoProjects.projects.READ

ZohoProjects.projects.CREATE

ZohoProjects.projects.ALL

ZohoProjects.tasks.READ

ZohoProjects.timesheets.READ

ZohoProjects.portals.READ

ZohoCRM.modules.deals.ALL


Any help would be much appreciated as I'm completely stuck now!

  1. void automation.Create_Projects_for_Closed_Potentials(String ProjName,String PortalName,Int id,String TemplateID,String Description,Date startdate,Date enddate)
  2. {
  3. createMap = Map();
  4. createMap.put("name",ProjName);
  5. // Provide name of the project to be created
  6. createMap.put("description",Description);
  7. createMap.put("start_date",startdate.toString("MM-dd-yyyy"));
  8. createMap.put("end_date",enddate.toString("MM-dd-yyyy"));
  9. createMap.put("template_id",TemplateID);
  10. // Notes :
  11. //Please uncomment the below lines in the code and change the connection api name. after creation of connection.
  12. response = zoho.projects.createProject(PortalName,createMap,"projects");
  13. info response;
  14. // Associate the project to the Deal in CRM
  15. mp = Map();
  16. mp.put("name",ProjName);
  17. datalist = List();
  18. datalist.add(mp);
  19. datamp = Map();
  20. datamp.put("data",datalist);
  21. resp2 = invokeurl
  22. [
  23. url :"https://www.zohoapis.com/crm/v2/Deals/" + id + "/Zoho_Projects/" + response.getJSON("projects").getJSON("id")
  24. type :POST
  25. parameters:datamp.toString()
  26. connection:"projects"
  27. ];
  28. info resp2;
  29. }

    Zoho Desk Resources

    • Desk Community Learning Series


    • Digest


    • Functions


    • Meetups


    • Kbase


    • Resources


    • Glossary


    • Desk Marketplace


    • MVP Corner


    • Word of the Day


      Zoho CRM Plus Resources

        Zoho Books Resources


          Zoho Subscriptions Resources

            Zoho Projects Resources


              Zoho Sprints Resources


                Zoho Orchestly Resources


                  Zoho Creator Resources


                    Zoho WorkDrive Resources



                      Zoho Campaigns Resources

                        Zoho CRM Resources

                        • CRM Community Learning Series

                          CRM Community Learning Series


                        • Tips

                          Tips

                        • Functions

                          Functions

                        • Meetups

                          Meetups

                        • Kbase

                          Kbase

                        • Resources

                          Resources

                        • Digest

                          Digest

                        • CRM Marketplace

                          CRM Marketplace

                        • MVP Corner

                          MVP Corner




                          Zoho Writer Writer

                          Get Started. Write Away!

                          Writer is a powerful online word processor, designed for collaborative work.

                            Zoho CRM コンテンツ




                              ご検討中の方