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.
 

      Create. Review. Publish.

      Write, edit, collaborate on, and publish documents to different content management platforms.

      Get Started Now


        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







                              Quick LinksWorkflow AutomationData Collection
                              Web FormsRetailOnline Data Collection Tool
                              Embeddable FormsBankingBegin Data Collection
                              Interactive FormsWorkplaceData Collection App
                              CRM FormsCustomer ServiceForms for Solopreneurs
                              Digital FormsMarketingForms for Small Business
                              HTML FormsEducationForms for Enterprise
                              Contact FormsE-commerceForms for any business
                              Lead Generation FormsHealthcareForms for Startups
                              Wordpress FormsCustomer onboardingForms for Small Business
                              No Code FormsConstructionRSVP tool for holidays
                              Free FormsTravelFeatures for Order Forms
                              Prefill FormsNon-Profit
                              Forms for Government
                              Intake FormsLegal
                              Mobile App
                              Form DesignerHR
                              Mobile Forms
                              Card FormsFoodOffline Forms
                              Assign FormsPhotographyMobile Forms Features
                              Translate FormsReal EstateKiosk in Mobile Forms
                              Electronic FormsInsurance
                              Drag & drop form builder

                              Notification Emails for FormsAlternativesSecurity & Compliance
                              Holiday FormsGoogle Forms alternative GDPR
                              Form to PDFJotform alternativeHIPAA Forms
                              Email FormsWufoo alternativeEncrypted Forms
                              Accessible FormsTypeform alternativeSecure Forms

                              WCAG

                                          Create. Review. Publish.

                                          Write, edit, collaborate on, and publish documents to different content management platforms.

                                          Get Started Now






                                                            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

                                                                  Use cases

                                                                  Make the most of Zoho Desk with the use cases.

                                                                   
                                                                    

                                                                  eBooks

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

                                                                   
                                                                    

                                                                  Videos

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

                                                                   
                                                                    

                                                                  Webinar

                                                                  Sign up for our webinars and learn the Zoho Desk basics, from customization to automation and more

                                                                   
                                                                    
                                                                  • Desk Community Learning Series


                                                                  • Meetups


                                                                  • Ask the Experts


                                                                  • Kbase


                                                                  • Resources


                                                                  • Glossary


                                                                  • Desk Marketplace


                                                                  • MVP Corner



                                                                    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 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