Zoho FSM | Create a Work Order in Zoho FSM from a Sales Order 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 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.


Step 2: Create a custom function in Zoho Books    

Create a custom function that will generate a Work Order in Zoho FSM from a Sales Order 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 Proceed:
    1. Function Name: createwofromso
    2. Module: Sales Order



  3. In the Deluge Script Editor, enter this script and click Save.
In Zoho Books, ensure that the status of the internal connections for Zoho Books, and Zoho FSM Integration tasks is Connected. The green dot [] indicates that the connection is Connected.
 

Step 3: Create a workflow rule in Zoho Books     

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



  2. In the New Workflow Rule popup, enter the following details and click Next:
    1. Workflow Rule Name: CreateWOFromSO
    2. Module: Sales Order



  3. For Workflow Rule Execution Condition, enter the following details and click Next.
    1. Workflow type: Event Based
    2. Action Type: 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. Ensure that the Sales Orders module is enabled in Zoho Books. You can check this at Settings > Preferences > General > Select the modules you would like to enable.



  2. Navigate to Sales > Sales Orders and click New.



  3. Enter the necessary details and save (Save as Draft, Save and Send, etc.) the sales order.
    If you are creating a sales order using a Zoho FSM contact, ensure that a Service Address, Billing Address, and Email is present for the contact. If you are creating a sales order using a customer present only in Zoho Books, ensure that the customer is of type Individual and they have an email. Since a work order in Zoho FSM should have at least one service, ensure that you add to the sales order a service that is present in Zoho FSM. If you do not want to add a service in your sales order, in Zoho FSM create a dummy service with Unit Price zero, and make use of it in the sales order.

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