Zoho FSM | Create an Estimate in Zoho Invoice from a Work Order in Zoho FSM

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  

Create a custom function in Zoho FSM that will generate an estimate in Zoho Invoice from a work order in Zoho FSM.
  1. Navigate to Setup > Automation > Functions and click Create Function.
  2. Enter the following details and click Save:
    1. Function Name: CreateEstimateFromWO
    2. Module: Work Order
    3. In the Deluge Script Editor, enter the following script:

      contact_id = work_order.get("Contact").toMap().get("id");
      contact_resp = zoho.fsm.getRecordById("Contacts",contact_id);
      invoice_contact_id = contact_resp.get("data").toMap().get("ZBilling_Id");
      listVar = List();
      Service_Line_Item_List = work_order.get("Service_Line_Items").toList();
      for each  line in Service_Line_Item_List
      {
       line_map = line.toMap();
       line_name = line_map.get("Service").toMap().get("name");
       line_id = line_map.get("Service").toMap().get("id");
       line_resp = zoho.fsm.getRecordById("Service_And_Parts",line_id);
       invoice_line_id = line_resp.get("data").toMap().get("ZBilling_Id");
       mapVar = Map();
       mapVar.put("item_id",invoice_line_id);
       mapVar.put("name",line_name);
       mapVar.put("rate",line_map.get("List_Price"));
       mapVar.put("quantity",line_map.get("Quantity"));
       listVar.add(mapVar);
      }
      Part_Line_Item_List = work_order.get("Part_Line_Items").toList();
      for each  line in Part_Line_Item_List
      {
       line_map = line.toMap();
       line_name = line_map.get("Part").toMap().get("name");
       line_id = line_map.get("Part").toMap().get("id");
       line_resp = zoho.fsm.getRecordById("Service_And_Parts",line_id);
       invoice_line_id = line_resp.get("data").toMap().get("ZBilling_Id");
       mapVar = Map();
       mapVar.put("item_id",invoice_line_id);
       mapVar.put("name",line_name);
       mapVar.put("rate",line_map.get("List_Price"));
       mapVar.put("quantity",line_map.get("Quantity"));
       listVar.add(mapVar);
      }
      values = Map();
      values.put("customer_id",invoice_contact_id);
      values.put("line_items",listVar);
      response = zoho.invoice.create("Estimates","<orgId>",values);
      info response;
Replace <orgId> with the actual value. To obtain the Organization ID, in Zoho Invoice, click the organization name at the top right corner and copy the Invoice Organization ID linked to your Zoho FSM account.


 
Additionally ensure that the status of the internal connections for Zoho FSM, and Zoho Invoice integration tasks are Connected. The green dot [] indicates that the connection is Connected.
 

Step 2: Create a workflow rule  

Create a workflow rule in Zoho FSM to automatically generate an estimate in Zoho Invoice whenever a Work Order is created in Zoho FSM.
  1. Go to Setup > Automation > Workflow Rules and click Create Workflow.
  2. Enter the following details, then click Next:
    1. Module: Work Orders
    2. Rule Name: CreateEstimateForWO
    3. Description: Generate an Estimate in Zoho Invoice when a Work Order is created in Zoho FSM.



  3. Select the rule trigger as Created and click Next.



  4. Select the rule criteria as To all Work Orders and click Next.



  5. Click +Action and select Function.



  6. Select Existing Functions and click Next.



  7. Select the custom function created in the previous step.



  8. Click Save.

Testing the usecase  

Create a Work Order in Zoho FSM.
 

 
An estimate will be created in Zoho Invoice.
 

    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 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 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 Project and Tasks in Zoho Project whenever an Invoice is generated in Zoho FSM

                                                                                                            Usecase: Create Project and Tasks in Zoho Project whenever an Invoice is generated for a Work Order in Zoho FSM. The work order should have an associated estimate. The project in Zoho Projects will be created with the name provided in the Project ...
                                                                                                          • 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 ...
                                                                                                          • Zoho FSM Mobile App

                                                                                                            The Zoho FSM mobile app empowers on-the-go field agents with all the information they need, to be efficient at work and delight contacts with every appointment. It helps them to be on time for their appointments, attend more appointments in a single ...
                                                                                                            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