Zoho FSM | Create Requests in Zoho FSM from Zoho CRM Deals

Create Requests in Zoho FSM from Zoho CRM Deals

Usecase: Using a custom button, push Deals in Zoho CRM as Requests to Zoho FSM. Also, create a related list in the Deals record that lists the Requests created for the Deal.

Step 1:  Create a connection for Zoho FSM in Zoho CRM  

To create a connection for Zoho FSM that can be used in Zoho CRM for invoking the Zoho FSM APIs, do the following:
  1. Log in to Zoho CRM.
  2. Navigate to Setup > Developer Hub > Connections and click Create Connection.

  3. In the Create Connection page, select the Custom Services tab and click Create New Service.

  4. In the Create Service page, enter the following details and click Create Service.
    1. Service Name: Zoho FSM
      The Service Link Name will be automatically populated.
    2. Authentication Type: OAuth2
    3. Parameter Type: Header
    4. Generated Client ID, Client Secret
    5. Authorize URL: https://accounts.zoho.com/oauth/v2/auth?access_type=offline&prompt=consent
    6. Access Token URL: https://accounts.zoho.com/oauth/v2/token
    7. Refresh Token URL: https://accounts.zoho.com/oauth/v2/token
    8. Scope: ZohoFSM.modules.all
      Provide values for Scope Display Name.

  5. Click Create Connection.
  6. Do the following and click Create And Connect:
    1. Connection Name: FSMConnection
    2. Select the Scopes ZohoFSM.modules.all

  7. Click Connect in the authentication page.

  8. Click Accept in the authorization page.

In the custom function, where FSM APIs are used via the invokeURL task, use this Connection Link Name.

Step 2: Create a custom button 

Create a custom button in the Deals module to push a CRM Deal as a Request in FSM.
To create a custom button:
  1. Navigate to Setup > Customization > Modules and Fields and click the Deals module.

  2. Select the Links and Buttons tab and click New Button.

  3. In the Create Your Button page, do the following and click Save:
    1. What would you like to name the button?: CreateRequestInFSM
    2. Where would you like to place the button?: Details Page
    3. What action would you like the button to perform?: Writing Function
      Create a custom function.

Step 3: Create a custom function 

  1. In the Create New Function popup, enter the following and click Create.
    1. Function Name: CreateRequestInFSM
    2. Display Name: CreateRequestInFSM

  2. In the Deluge Script Editor, click Edit Arguments.

  3. In the Edit Arguments popup, do the following:
    1. Enter the argument name as deal_Id.
    2. For the argument value, type # and select Deals - Deal Id and click Done.

  4. Click Save.

  5. Add the script and click Save.

    dealResp = zoho.crm.getRecordById("Deals",deal_Id);
    if(dealResp != null)
     Summary = dealResp.get("Deal_Name");
      Fetch Account related information
     Account_Name = dealResp.get("Account_Name").toMap().get("name");
     Encoded_Account_Name = zoho.encryption.urlEncode(Account_Name);
     response = invokeurl
      type :GET
     response_data = response.get("data").toMap();
     FSM_Account_id = response_data.get("id");
      Fetch Contact related information
     Contact_Id = dealResp.get("Contact_Name").toMap().get("id");
     Contact_Resp = zoho.crm.getRecordById("Contacts",Contact_Id);
     Contact_Email = Contact_Resp.get("Email");
     responze = invokeurl
      type :GET
     FSM_Contact_id = responze.get("data").toMap().get("id");
     Billing_Address_resp = responze.get("data").toMap().get("Billing_Address");
     if(Billing_Address_resp != null)
      Billing_Address_resp = Billing_Address_resp.toMap();
      bill_add_map = Map();
     Service_Address_resp = responze.get("data").toMap().get("Service_Address");
     if(Service_Address_resp != null)
      Service_Address_resp = Service_Address_resp.toMap();
      ship_add_map = Map();

    terrResp = zoho.fsm.getRecords("Territories");
    terrId = terrResp.get("data").toMap().get("id");

    createMap = Map();
    createMap.put("Territory", terrId);
    create_resp = zoho.fsm.createRecord("Requests",createMap);
    reqId = create_resp.get("data").toMap().get("Requests").toMap().get("id");
    reqId = reqId + ",";
    dealResp = zoho.crm.getRecordById("Potentials",deal_Id);
    fieldVal = dealResp.get("Request_IDs");
    if(fieldVal != null)
     reqId = reqId + fieldVal;
    updateMap = Map();
    updateResp = zoho.crm.updateRecord("Potentials",deal_Id,updateMap);
    return "Function executed successfully";

Create a custom field

In Zoho CRM, create a field Request_IDs of type Single Line. This field will be used to store the IDs of the requests created for the Deal. The request IDs stored in this field will be used to create the related list

To create the custom field:
  1. Navigate to Setup > Customization > Modules and Fields. Hover over the Deals module and click on Fields.

  2. Click Create and Edit Fields.

  3. Add a field named Request_IDs and click Save.

Create a related list in the Deals record that lists the requests created for the deal.
  1. Navigate to a Deals record and click Add Related List.

  2. In the Add Related List popup, click Functions.

  3. In the Existing Functions popup, click Create New Function.

  4. In the Create New Function popup, enter the following and click Create.
    1. Function Name: AssociatedRequests
    2. Display Name: AssociatedRequests

  5. In the Deluge Script Editor, click Edit Arguments.

  6. In the Edit Arguments popup, do the following:
    1. Enter the argument name as deal_Id.
    2. For the argument value, type # and select Deals - Deal Id and click Done.

  7. Click Save.

  8. Add the script and click Save.

    response = zoho.crm.getRecordById("Potentials",deal_Id);
    fieldVal = response.get("Request_IDs");
    products = fieldVal;
    productList = products.toList(",");
    responseXML = "";
    for each  productListItem in productList
     rowVal = 0;
     url = "https://fsm.zoho.com/home#/tab/Requests/" + productListItem;
     responseXML = responseXML + "<row cnt='" + rowVal + "'><FL val='Request ID' link=\"true\" url=\"" + url + "\">" + productListItem + "</FL></row>";
     rowVal = rowVal + 1;
    return responseXML;

  9. In the Create Custom Related List popup, click Save.

Testing the use case   

Click the CreateRequestInFSM button in a deals record.
Ensure the contact in the deal is already present in Zoho FSM and also that the has a service address and billing address. Use this custom function to push the contact from CRM to FSM.

A new Request will be created in FSM.

In the Deals record, the related list will be updated with the ID of the request created for this deal.

    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

                                                                                                      • Related Articles

                                                                                                      • Integrating Zoho FSM with Zoho CRM

                                                                                                        Zoho FSM for Zoho CRM is a must-have extension for increasing collaboration between your sales and service teams. It can benefit the sales and service teams by providing them with a consolidated view of customers, enabling quicker and more efficient ...
                                                                                                      • Zoho FSM Extension for Zoho CRM (Direct Data Sync)

                                                                                                        Prerequisites - Standard edition or above of Zoho FSM - Standard edition or above of Zoho CRM - Zoho CRM is not integrated with a Zoho Finance Suite (Books/Invoice) org Install the Extension You can install Zoho FSM for Zoho CRM either from Zoho ...
                                                                                                      • Requests

                                                                                                        Requests are initiated to render services to customers. Services are the offerings you provide as part of your field services. Customers can contact a call cent agent to raise the request on their behalf. You can create requests from the Zoho FSM web ...
                                                                                                      • Zoho FSM Extension for Zoho CRM (Data Sync via Zoho Books/Invoice)

                                                                                                        Prerequisites - Standard edition of Zoho FSM - Standard edition or above of Zoho CRM Install the Extension You can install Zoho FSM for Zoho CRM either from Zoho Marketplace or from Zoho CRM. To install the extension from your Zoho CRM account: ...
                                                                                                      • Push Zoho CRM Contacts and Accounts to Zoho FSM

                                                                                                        Usecase: Use custom buttons in Zoho CRM to do the following: Push (create/update) a Zoho CRM contact to Zoho FSM. If the contact has an associated account, create that account as a company in FSM. Push (create/update) a Zoho CRM account as a company ...
                                                                                                        Wherever you are is as good as
                                                                                                        your workplace



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


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


                                                                                                          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