Zoho FSM | Create a Work Order in Zoho FSM whenever a Subscription is created or renewed

Create a Work Order in Zoho FSM whenever a Subscription is created or renewed

Use case: Whenever a subscription is created or renewed in Zoho Billing, create a Work Order in Zoho FSM.
 

Step 1: Add a service named ForZBilling

In Zoho FSM, create a service called ForZBilling. Use this service in the work order that you create when a subscription is created or renewed in Zoho Billing.
 

Step 2: Create a connection for Zoho FSM in Zoho Billing

To create a connection for Zoho FSM that can be used in Zoho Billing for invoking the Zoho FSM APIs, do the following:
  1. Log in to Zoho Billing.
  2. Navigate to Settings > Developer Space > Connections and click New 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 a Scope Display Name.



  5. Do the following and click Create And Connect:
    1. Connection Name: Zoho FSM
    2. Select the Scope ZohoFSM.modules.all.



  6. Click Connect.



  7. Click Accept.

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

Step 3: Create a custom function in Zoho Billing 

Add a custom function in Zoho Billing to create a work order in Zoho FSM whenever a subscription is created or renewed in Zoho Billing.
  1. Navigate to Settings > Automation > Custom Functions and click New Custom Function.



  2. In the New Custom Function page, enter the following details:
    1. Name: CreateWOInZFSM
    2. Module: Subscriptions
    3. Select New Subscription, and Subscription Renewal under Predefined Events > Immediate Events.



  3. In the Deluge Script Editor, enter the following script and click Save:


    custEmail = subscriptions.get("customer").toMap().get("email");
    response = zoho.fsm.searchRecordsByField("Contacts","Email",custEmail,Map(),"zohofsm");
    subscription_number = subscriptions.get("subscription_number");
    name = subscriptions.get("name");
    summary = subscription_number + ":" + name;
    response = response.get("data").toMap();
    tax = response.get("Tax").toMap();
    //info tax; 
    custId = response.get("id");
    companyMap = response.get("Company");
    if(companyMap == null)
    {
    compId = "";
    }
    else
    {
    compId = companyMap.toMap().get("id");
    }
    serviceAddressMap = response.get("Service_Address");
    if(serviceAddressMap == null)
    {
    serviceAddressId = "";
    }
    else
    {
    serviceAddressId = serviceAddressMap.toMap().get("id");
    }
    billingAddressMap = response.get("Billing_Address");
    if(billingAddressMap == null)
    {
    billingAddressId = "";
    }
    else
    {
    billingAddressId = billingAddressMap.get("id");
    }
    Service_Address_Map = Map();
    Billing_Address_Map = Map();
    Service_Address_Map.put("id",serviceAddressId);
    Billing_Address_Map.put("id",billingAddressId);
    serviceList = List();
    response1 = zoho.fsm.searchRecordsByField("Service_And_Parts","Name","ForZBilling",Map(),"zohofsm");
    //info response1;
    if(!response1.isNull() && !response1.isEmpty())
    {
    service = response1.get("data").toMap();
    serviceMap = Map();
    serviceMap.put("Quantity",1);
    serviceMap.put("Sequence",1);
    serviceMap.put("List_Price",service.get("Unit_Price"));
    serviceMap.put("Service",service.get("id"));
    serviceMap.put("Contact",custId);
    serviceMap.put("Tax",tax);
    serviceList.add(serviceMap);
    }
    terrResp = zoho.fsm.getRecords("Territories");
    terrId = terrResp.get("data").toMap().get("id");
    createWOMap = Map();
    createWOMap.put("Summary",summary);
    createWOMap.put("Priority","Medium");
    createWOMap.put("Type","Service");
    createWOMap.put("Email",custEmail);
    createWOMap.put("Contact",custId);
    createWOMap.put("Company",compId);
    createWOMap.put("Territory",terrId);
    createWOMap.put("Service_Address",Service_Address_Map);
    createWOMap.put("Billing_Address",Billing_Address_Map);
    createWOMap.put("Service_Line_Items",serviceList);
    info "createWOMap: " + createWOMap;
    woResp = zoho.fsm.createRecord("Work_Orders",createWOMap);
    info woResp;

Testing the use case 

Following are the steps to test the use case discussed:
  1. Select Subscriptions in the left menu and click on + New Subscription.



  2. Select a Customer, add a Plan and click Continue. Select the checkbox Collect payment offline.
    Ensure that the contact you choose is present in Zoho FSM. A Service Address, Billing Address, and Email should be present for the contact.



  3. Click Create.


A work order is created in Zoho FSM.
 

    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

                                                                                                          • Create a Work Order in Zoho FSM from a Sales Order in Zoho Books

                                                                                                            Use case: Whenever a Sales Order is created in Zoho Books, create a Work Order for it in Zoho FSM. Follow the steps below to implement this use case: Step 1: Create a connection for Zoho FSM in Zoho Books Step 2: Create a custom function in Zoho ...
                                                                                                          • Create an Estimate in Zoho Invoice from a Work Order in Zoho FSM

                                                                                                            Use case: Whenever a Work Order is created in Zoho FSM, create an Estimate for it in Zoho Invoice. Follow the steps below to implement this use case: Step 1: Create a custom function Step 2: Create a workflow rule Step 1: Create a custom function ...
                                                                                                          • Create a Work Order in Zoho FSM from an Invoice in Zoho Books

                                                                                                            Use case: Whenever an Invoice is created in Zoho Books, create a Work Order for it in Zoho FSM. Follow the steps below to implement this use case: Step 1: Create a connection for Zoho FSM in Zoho Books Step 2: Create a custom function in Zoho Books ...
                                                                                                          • Create a Work Order in Zoho FSM from a Task in Zoho Desk

                                                                                                            Usecase: Create a Work order in Zoho FSM whenever a Task is added in Zoho desk. Step 1: Create a connection for Zoho FSM in Zoho Desk Step 2: Create a custom function Step 3: Create a workflow rule Step 1: Create a connection for Zoho FSM in Zoho ...
                                                                                                          • Create an event in monday.com Calendar for a Zoho FSM Work Order

                                                                                                            Use case: Create an event in the monday.com calendar when a work order is created Step 1: Create a custom function Step 2: Create a workflow rule Step 1: Create a custom function Add a custom function that will create an event in Monday.com calendar ...
                                                                                                            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