Choose where you’d like to start

Create Record in Zoho FSM

Overview

You can create a record in the specified module of FSM using the zoho.fsm.createRecord() task.

This task is based on Zoho FSM API -> <Module> APIs -> Create <ModuleName>

Syntax

<variable> = zoho.fsm.createRecord(<module_name>, <record_details>, <optional_data_map>, <connection>);

where,

ParamsData typeDescription
<variable> KEY-VALUEis the response returned by Zoho FSM.
<module_name>TEXT

is the API name of the Zoho FSM module where the record will be added.

The API names of the modules are:
Assets, Companies, Contacts, Estimates, Invoices, Requests, Scheduled_Maintenances, Service_And_Parts, Service_Appointments, Time_Off, Work_Orders

 

<record_details>KEY-VALUE

is a map with details of the record that needs to be inserted into the module

Note: To learn about the mandatory fields, click here and navigate to <Module> APIs -> Create <ModuleName>

 

<optional_data_map>

(optional)

KEY-VALUE

is a Map parameter to pass any additional values. If you want to ignore this parameter, supply an empty map.

Note: To learn about the optional parameters, click here and navigate to <Module> APIs -> Create <ModuleName>

<connection>

(optional)

TEXT

is the name of the connection.

Note: Add relevant scopes as mentioned in Zoho FSM API -> <Module> -> Create <ModuleName>. 

 

Example: Creating a Request record

The following script will create a Request record in FSM:

emptyMap = Map(); 
 
serviceAddress = Map(); 
serviceAddress.put("id", "1439XXXXXXXX1231"); 
 
billingAddress = Map(); 
billingAddress.put("id", "1439XXXXXXXX1230"); 
 
newRecordInfo = Map(); 
newRecordInfo.put("Summary", "Sample"); 
newRecordInfo.put("Status", "New"); 
newRecordInfo.put("Contact", "1439XXXXXXXX1222"); 
newRecordInfo.put("Territory","1439XXXXXXXX1185"); 
newRecordInfo.put("Service_Address",serviceAddress); 
newRecordInfo.put("Billing_Address",billingAddress); 
 
response = zoho.fsm.createRecord("Requests", newRecordInfo, emptyMap, "fsm_connection");

where:

newRecordInfo
is the KEY-VALUE containing the values for the record to be created
"Summary" 
"Status" 
"Contact" 
"Territory" 
"Service_Address" 
"Billing_Address"
are the API names of Zoho FSM fields. They are of TEXT data type.
"Requests"
is the TEXT that represents the API name of the Zoho FSM module where the record will be created
response
is the KEY-VALUE response returned by Zoho FSM. 
"fsm_connection"
is the TEXT that represents the link name of the connection created for Zoho FSM.

Response Format

Success Response

  • The response returned is of the following format:

     {
     "result": "success",
     "code": "SUCCESS",
     "data": {
     "Requests": [
     {
     "UID": "Requests_0",
     "Modified_Time": "2022-05-16T03:56:17-07:00",
     "Modified_By": {
     "name": "Mary Cooper",
     "id": "1439XXXXXXXX1001"
     },
     "Created_Time": "2022-05-16T03:56:17-07:00",
     "id": "1439XXXXXXXX5716",
     "Created_By": {
     "name": "Mary Cooper",
     "id": "1439XXXXXXXX1001"
     },
     "TabName": "Requests"
     }
     ]
     },
     "status": "success"
     }

To get the ID of the newly created record, execute the following script:

<variable> = response.get("data").get("Requests").get(0).get("id").toLong();

Related Links

Get Started Now

Execute