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

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
Step 3: Create a workflow rule in Zoho Books

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

To create a connection for Zoho FSM that can be used in Zoho Books for invoking the Zoho FSM APIs, do the following:
  1. Log in to Zoho Books.
  2. Navigate to Settings > Developer Data > Connections and click New Connection.



  3. Under the Default Services tab, search for and click Zoho FSM.



  4. Do the following and click Create And Connect:
    1. Connection Name: Zoho FSM
      The Connection Link Name will be automatically populated.
    2. Disable Use Credentials Of Login User. If this is disabled, the connection will utilize the credentials of the connection owner.

    3. Select the Scope ZohoFSM.modules.all.



  5. Click Connect in the authentication page.



  6. Click Accept in the Authorization page.


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


Additionally ensure that the status of the internal connection for Zoho Books Integration tasks is Connected. The green dot [] indicates that the connection is Connected.

Step 2: Create a custom function in Zoho Books  

Create a custom function that will generate a Work Order in Zoho FSM from an Invoice in Zoho Books.
  1. Navigate to Settings > Automation > Workflow Actions. Select Custom Functions and click New Custom Function.



  2. Enter the following details and click Save:
    1. Function Name: createwofrombooks
    2. Module: Invoice



  3. In the Deluge Script Editor, enter this script.

Step 3: Create a workflow rule in Zoho Books

Create a workflow that will generate a Work Order in Zoho FSM whenever an Invoice is created in Zoho Books.
  1. Navigate to Settings > Automation > Workflow Rules and click New Workflow Rule.



  2. In the New Workflow Rule screen, enter the following details and click Next:
    1. Workflow Rule Name: CreateWOInZFSM
    2. Module: Invoice



  3. For Workflow Rule Execution Condition, enter the following details and click Next.
    1. Workflow Type: Event Based
    2. Action Type: When invoice is created



  4. Click New Criteria.
  5. Select No for Add criteria for this workflow rule? and click Done.



  6. Click Immediate Actions.



  7. Select the Type as Custom Functions and for Name, select the function created in the previous step. Click Associate.



  8. Click Save.


Testing the use case  

Following are the steps to test the use case discussed.
  1. Navigate to Sales > Invoices and click New.



  2. Enter the necessary details and save (Save as Draft, Save and Send, etc.) the invoice.
    Ensure that the contact you choose is present in Zoho FSM. A Service Address, Billing Address, and Email should be present for the contact. Since a work order in Zoho FSM should have atleast one service, ensure that you add to the invoice a service that is present in Zoho FSM. If there are no services in your invoice, in Zoho FSM create a dummy service with Unit Price zero, and add it to the invoice.

A new work order is created in Zoho FSM for the same customer for whom the invoice was created in Books.