Push data to Zoho CRM

Push data to Zoho CRM

Zoho Creator can push Form data to Zoho CRM. Below example steps (and explanation) tell you how to add a CRM lead from Zoho Creator Form.

We have created a sample application for this at 
https://creator.zoho.com/sampleapps/push-data-to-zoho-crm/# . Sign in and click on options (at the top) -> Copy application to copy it to your account.
1. Create a Lead Form in Zoho Creator:

Create a Zoho Creator Form with the following fields. (See  https://help.creator.zoho.com/By-adding-new-forms.html  )
  1. Company Name (field type - Single Line)
  2. Name (field type -  Single Line)
  3. Telephone (field type -   Single Line)
  4. Email Address (field type -   Email)
  5. File Upload field (for adding attachments)

2. Write the script:

Go to the  On Add -> On Success  section of the above Form and navigate to Free flow script builder (See this  image   pointer 7 ).

      2.1. Create the CRM vs Creator fields map:

            It is important to set up the field mapping for the Zoho Creator system to push data to the right fields on the CRM module. Sample below. Final script is given at the end of the article.
                  
                  //create a map variable. Refer to Stephen's post
                  myFieldMap = map();
                  //add values to the map. CRM fields first and then Creator fields ( without the quotes ). Creator field's  deluge name  is used here.
                  myFieldMap.put("Company", Company_Name);
                  //note that in the above line, Company is the CRM field and Company_Name is the Creator field
                  myFieldMap.put("Last Name", Name);
                  myFieldMap.put("Phone", Telephone);
                  myFieldMap.put("Email", Email_Address);

Update : Adding attachments is supported too. Script syntax is,

            myFieldMap.put("Attachment" , input.File_upload);

Note : Keyword Attachment is used for file upload field. Refer to this response

      2.2. Write the function to push data to CRM:
                  
            The syntax of the function that pushes data to CRM from Creator looks like below. 

                  response = zoho.crm.create( CRM Module Name Fields map );

      2.2.1 Function explanation:

                  1. zoho.crm.create() is the function that tells Zoho Creator system to add new record in CRM. 
                  2. CRM Module Name and the Fields map (refer to section 2.1) are passed to the function to make sure the right record is added to the right module.
                  3. Response stores the result of the action (success or failure with the record ID of the CRM module).

      2.2.2 Example script (continued)

            According to our example, the below script should be written at the end of the script given at (section 2.1).

                       response = zoho.crm.create("Leads", myFieldMap);

So the final script will be 

                  myFieldMap = map();
                  myFieldMap.put("Company", Company_Name);
                  myFieldMap.put("Last Name", Name);
                  myFieldMap.put("Phone", Telephone);
                  myFieldMap.put("Email", Email_Address);
                   myFieldMap.put("Attachment" , input.File_upload);
                   response = zoho.crm.create("Leads", myFieldMap);

Click on Save Script.

Submit data on your Creator Form and check the lead in CRM.

Note : This article captures only 5 basic fields from CRM Leads module. You can use other fields in the same method too.

References: