How to add attachments alone to the contact from which the document was sent?

How to add attachments alone to the contact from which the document was sent?

Scenario: I send the documents to Zoho Sign using the 'Send with Zoho Sign' button on the Contacts view page. Once the document is sent for signing, the document details and the attachments are added to the 'Zoho Sign Documents' module. I want the attachments alone to be added to the contact from which the document was sent. Can I do this using a workflow in CRM?
This code will attach the signed document to the record from which it was triggered. For example if you have sent from record 'A' in module 'XYZ', then the signed document will be added to this record 'A'.
  1. Open ZohoCRM page, then navigate to Setup -> Customization -> Workflow rules. Create a new Workflow for the Zoho Sign Documents module.
  2. 'On a record action' -> 'Edit'
  3. Click the checkbox for Repeat this workflow whenever a Zoho Sign documents is edited.
  4. Select 'Specific field(s) gets modified'
  5. When 'Document Status' is modified to 'the value' as Signed.
  6. For the condition'Which Zoho Sign documents would you like to apply the rule to?', select the value as All Zoho Sign Documents.
                                -->Click Next.
                                -->In the list of action, select function
  7. Select the value Create your own function.
  8. Name the function and create it.
  9. Edit the arguments in the function.
  10. Add the key name as 'requestId', in the value type in # and select 'Zoho Sign Documents' module with fields as 'Zoho Sign Document Id'.
  11. Use the below code in the function and replace your Zoho Sign connection name.
  12. For Creating connection -> Go to Setup -> Developer Space -> Connections -> Create new Connection -> Select 'Zoho OAuth' -> give connection name here -> Use the same 'Connection Link Name' in the function.
  13. Select the following scopes --> Zoho Sign.account.ALL, Zoho Sign.documents.ALL, Zoho Sign.setup.READ, Zoho Sign.templates.ALL
  14. Click Create and Connect.
  15. Save the function and the workflow rules.
  1. response = invokeurl
  2. [
  3.   url :"https://sign.zoho.com/api/v1/requests/" + requestId
  4.  type :GET
  5.  connection:"Use Connection Name here"
  6. ];
  7. requestObj = response.get("requests");
  8. info requestObj;
  9. if(requestObj.containKey("request_status"))
  10. {
  11.  reqStatus = requestObj.get("request_status");
  12.  info reqStatus;
  13.  if(reqStatus.equals("completed") || reqStatus.equals("expired") || reqStatus.equals("declined") || reqStatus.equals("recalled"))
  14.  {
  15.   requestId = requestObj.get("request_id");
  16.   actions = requestObj.get("actions");
  17.   document_ids = requestObj.get("document_ids");
  18.   email = "";
  19.   order = 1000;
  20.   for each  action in actions
  21.   {
  22.    if(action.get("action_type").equals("SIGN") && action.get("signing_order") < order)
  23.    {
  24.     order = action.get("signing_order");
  25.     email = action.get("recipient_email");
  26.     records = zoho.crm.searchRecords("Custom_Module_Name","(Email:equals:" + email + ")");
  27.     if(records.size() > 0)
  28.     {
  29.      leadid = records.get(0).get("id");
  30.      for each  document in document_ids
  31.      {
  32.       document_id = document.get("document_id");
  33.       fileResponse = invokeurl
  34.       [
  35.        url :"https://sign.zoho.com/api/v1/requests/" + requestId + "/documents/" + document_id + "/pdf"
  36.        type :GET
  37.        connection:"Use Connection Name here"
  38.       ];
  39.       zoho.crm.attachFile("Custom_Module_Name",leadid,fileResponse);
  40.      }
  41.      fileResponse = invokeurl
  42.      [
  43.       url :"https://sign.zoho.com/api/v1/requests/" + requestId + "/completioncertificate"
  44.       type :GET
  45.       connection:"Use Connection Name here"
  46.      ];
  47.      zoho.crm.attachFile("Custom_Module_Name",leadid,fileResponse);
  48.     }
  49.    }
  50.    break;
  51.   }
  52.  }
  53. }


    Access your files securely from anywhere

      Zoho CRM Training Programs

      Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

      Zoho CRM Training
        Redefine the way you work
        with Zoho Workplace

          Zoho DataPrep Personalized Demo

          If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

          Zoho CRM Training

            Create, share, and deliver

            beautiful slides from anywhere.

            Get Started Now


              Zoho Sign now offers specialized one-on-one training for both administrators and developers.

              BOOK A SESSION









                                            You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                                Manage your brands on social media

                                                  Zoho Desk Resources

                                                  • Desk Community Learning Series


                                                  • Digest


                                                  • Functions


                                                  • Meetups


                                                  • Kbase


                                                  • Resources


                                                  • Glossary


                                                  • Desk Marketplace


                                                  • MVP Corner


                                                  • Word of the Day


                                                    Zoho Marketing Automation

                                                      Zoho Sheet Resources

                                                       

                                                          Zoho Forms Resources


                                                            Secure your business
                                                            communication with Zoho Mail


                                                            Mail on the move with
                                                            Zoho Mail mobile application

                                                              Stay on top of your schedule
                                                              at all times


                                                              Carry your calendar with you
                                                              Anytime, anywhere




                                                                    Zoho Sign Resources

                                                                      Sign, Paperless!

                                                                      Sign and send business documents on the go!

                                                                      Get Started Now




                                                                              Zoho TeamInbox Resources



                                                                                      Zoho DataPrep Resources



                                                                                        Zoho DataPrep Demo

                                                                                        Get a personalized demo or POC

                                                                                        REGISTER NOW


                                                                                          Design. Discuss. Deliver.

                                                                                          Create visually engaging stories with Zoho Show.

                                                                                          Get Started Now









                                                                                                                Wherever you are is as good as
                                                                                                                your workplace

                                                                                                                  Resources

                                                                                                                  Videos

                                                                                                                  Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                                                  eBooks

                                                                                                                  Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                                                  Webinars

                                                                                                                  Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                                  CRM Tips

                                                                                                                  Make the most of Zoho CRM with these useful tips.



                                                                                                                    Zoho Show Resources