Get Records from Zoho FSM
Table of Contents
Description
You can fetch records from a specified module using the zoho.fsm.getRecords Deluge task.
This task is based on Zoho FSM API -> <Module> -> List <ModuleName>.
Syntax
<variable> = zoho.fsm.getRecords(<module_name>, <page>, <per_page>, <optional_data_map>, <connection>);
where:
Params | Data type | Description |
<variable> | KEY-VALUE | is the response returned by Zoho FSM. |
<module_name> | TEXT | is the API name of the module from which you want to fetch records. The API names of the modules are: |
<page> (optional) | NUMBER | indicates the page number from which you want to retrieve records. Default value: 1 |
<per_page> (optional) | NUMBER | is the number of records that need to be fetched per page. Default value: 200 |
<optional_data_map> (optional) | KEY-VALUE | is the parameter to pass any additional values. Note:
|
<connection> (optional) | TEXT | is the connection created for Zoho FSM. Note: Add relevant scopes as mentioned in Zoho FSM API -> <Module> -> List <ModuleName>.
|
Example: Retrieve records from the Request module
The following script fetches the first 4 records from the Zoho FSM Requests module and sorts the fetched records in descending order based on the field - Name.
optionalDataMap = Map(); optionalDataMap.put("sort_by", "Name"); optionalDataMap.put("sort_order", "desc"); response = zoho.fsm.getRecords("Requests", 1, 4, optionalDataMap, "fsm_connection");
where:
response
"Requests"
1
4
optionalDataMap
"fsm_connection"
Response Format
The success response returned is of the following format:
"data": [
{
"Owner": {
"name": "Mary Cooper",
"id": "1439000000161001",
"email": "shawn@zylker.com"
},
"Company": null,
"Email": null,
"$currency_symbol": "$",
"Cancellation_Reason": null,
"Config": null,
"Closed_Time": null,
"Reported_By": null,
"Cancelled_Or_Terminated_Time": null,
"Dispatcher": {
"name": "Mary Cooper",
"id": "1439000000161001"
},
"Name": "REQ13",
"Modified_By": {
"name": "Mary Cooper",
"id": "1439000000161001",
"email": "shawn@zylker.com"
},
"Exchange_Rate": 1,
"Phone": null,
"Cancellation_Message": null,
"Currency": "USD",
"$inactive": false,
"Service_Address": {
"Service_Latitude": 41.491496,
"Service_Street_1": "4117 Kennedy Dr",
"Service_State": "Illinois",
"Service_Zip_Code": "61244",
"name": "AD-2",
"id": "1439000000161231",
"Service_Longitude": -90.457028,
"Service_Address_Name": "Service Address",
"Service_Street_2": null,
"Service_Country": "United States",
"Service_City": "East Moline"
},
"Asset": null,
"id": "1439000000185716",
"Status": "New",
"Territory": {
"name": "Colona",
"id": "1439000000161185"
},
"Modified_Time": "2022-05-16T03:56:17-07:00",
"Due_Date": null,
"Priority": null,
"Created_Time": "2022-05-16T03:56:17-07:00",
"$editable": true,
"Completed_Time": null,
"$permissions": {
"read": true,
"edit": true,
"delete": true
},
"Estimate_Required": false,
"Contact": {
"name": "Lucy Robins",
"id": "1439000000161222"
},
"Parent_Work_Order": null,
"Request_Origin": null,
"Preference": {
"Preferred_Date_1": null,
"Preferred_Date_2": null,
"Preference_Note": null,
"Preferred_Time": null
},
"Billing_Address": {
"Billing_Longitude": -90.358476,
"Billing_City": "Colona",
"Billing_Country": "United States",
"name": "AD-1",
"Billing_Address_Name": "Billing Address",
"Billing_Street_1": "901 1st St",
"Billing_State": "Illinois",
"Billing_Zip_Code": "61241",
"Billing_Street_2": null,
"Billing_Latitude": 41.469353,
"id": "1439000000161230"
},
"Summary": "Sample",
"Created_By": {
"name": "Mary Cooper",
"id": "1439000000161001",
"email": "shawn@zylker.com"
}
},
{
"Owner": {
"name": "Mary Cooper",
"id": "1439000000161001",
"email": "shawn@zylker.com"
},
"Company": null,
"Email": null,
"$currency_symbol": "$",
"Cancellation_Reason": null,
"Config": null,
"Closed_Time": null,
"Reported_By": null,
"Cancelled_Or_Terminated_Time": null,
"Dispatcher": {
"name": "Mary Cooper",
"id": "1439000000161001"
},
"Name": "REQ10",
"Modified_By": {
"name": "Mary Cooper",
"id": "1439000000161001",
"email": "shawn@zylker.com"
},
"Exchange_Rate": 1,
"Phone": null,
"Cancellation_Message": null,
"Currency": "USD",
"$inactive": false,
"Service_Address": {
"Service_Latitude": 41.491496,
"Service_Street_1": "4117 Kennedy Dr",
"Service_State": "Illinois",
"Service_Zip_Code": "61244",
"name": "AD-2",
"id": "1439000000161231",
"Service_Longitude": -90.457028,
"Service_Address_Name": "Service Address",
"Service_Street_2": null,
"Service_Country": "United States",
"Service_City": "East Moline"
},
"Asset": null,
"id": "1439000000186166",
"Status": "New",
"Territory": {
"name": "Colona",
"id": "1439000000161185"
},
"Modified_Time": "2022-05-15T23:08:22-07:00",
"Due_Date": null,
"Priority": null,
"Created_Time": "2022-05-15T23:08:22-07:00",
"$editable": true,
"Completed_Time": null,
"$permissions": {
"read": true,
"edit": true,
"delete": true
},
"Estimate_Required": false,
"Contact": {
"name": "Lucy Robins",
"id": "1439000000161222"
},
"Parent_Work_Order": null,
"Request_Origin": null,
"Preference": {
"Preferred_Date_1": null,
"Preferred_Date_2": null,
"Preference_Note": null,
"Preferred_Time": null
},
"Billing_Address": {
"Billing_Longitude": -90.358476,
"Billing_City": "Colona",
"Billing_Country": "United States",
"name": "AD-1",
"Billing_Address_Name": "Billing Address",
"Billing_Street_1": "901 1st St",
"Billing_State": "Illinois",
"Billing_Zip_Code": "61241",
"Billing_Street_2": null,
"Billing_Latitude": 41.469353,
"id": "1439000000161230"
},
"Summary": "Sample",
"Created_By": {
"name": "Mary Cooper",
"id": "1439000000161001",
"email": "shawn@zylker.com"
}
},
{
"Owner": {
"name": "Mary Cooper",
"id": "1439000000161001",
"email": "shawn@zylker.com"
},
"Company": {
"name": "ABC Services",
"id": "1439000000161212"
},
"Email": "betty@zylker.com",
"$currency_symbol": "$",
"Cancellation_Reason": null,
"Config": "{\"sales_tax_type\":\"exclusive\",\"tax_rounding_type\":\"not_configured\",\"Type\":\"32\",\"is_discount_before_tax\":true,\"is_inclusive_tax\":false,\"is_discount_tax_inclusive\":false,\"discount_type\":\"entity_level\",\"is_sales_inclusive_tax_enabled\":false,\"transaction_rounding_type\":\"no_rounding\",\"is_registered_for_tax\":true,\"Tax_Details\":{\"Tax_Percentage\":7,\"Tax_Id\":\"3219741000000078015\",\"taxFromModule\":\"Addresses\",\"Tax_Name\":\"SalesTax\",\"Taxable\":true}}",
"Closed_Time": null,
"Reported_By": null,
"Cancelled_Or_Terminated_Time": null,
"Dispatcher": {
"name": "Mary Cooper",
"id": "1439000000161001"
},
"Name": "REQ1",
"Modified_By": {
"name": "Mary Cooper",
"id": "1439000000161001",
"email": "shawn@zylker.com"
},
"Exchange_Rate": 1,
"Phone": "111-111-1111",
"Cancellation_Message": null,
"Currency": "USD",
"$inactive": false,
"Service_Address": {
"Service_Latitude": 41.491496,
"Service_Street_1": "4117 Kennedy Dr",
"Service_State": "Illinois",
"Service_Zip_Code": "61244",
"name": "AD-2",
"id": "1439000000161231",
"Service_Longitude": -90.457028,
"Service_Address_Name": "Service Address",
"Service_Street_2": null,
"Service_Country": "United States",
"Service_City": "East Moline"
},
"Asset": null,
"id": "1439000000185139",
"Status": "Work In Progress",
"Territory": {
"name": "Colona",
"id": "1439000000161185"
},
"Modified_Time": "2022-05-16T00:48:58-07:00",
"Due_Date": null,
"Priority": "Medium",
"Created_Time": "2022-05-12T03:42:38-07:00",
"$editable": true,
"Completed_Time": null,
"$permissions": {
"read": true,
"edit": true,
"delete": true
},
"Estimate_Required": false,
"Contact": {
"name": "Lucy Robins",
"id": "1439000000161222"
},
"Parent_Work_Order": null,
"Request_Origin": null,
"Preference": {
"Preferred_Date_1": null,
"Preferred_Date_2": null,
"Preference_Note": null,
"Preferred_Time": null
},
"Billing_Address": {
"Billing_Longitude": -90.358476,
"Billing_City": "Colona",
"Billing_Country": "United States",
"name": "AD-1",
"Billing_Address_Name": "Billing Address",
"Billing_Street_1": "901 1st St",
"Billing_State": "Illinois",
"Billing_Zip_Code": "61241",
"Billing_Street_2": null,
"Billing_Latitude": 41.469353,
"id": "1439000000161230"
},
"Summary": "Bathroom floor repair",
"Created_By": {
"name": "Mary Cooper",
"id": "1439000000161001",
"email": "shawn@zylker.com"
}
}
],
"info": {
"per_page": 4,
"count": 3,
"page": 1,
"more_records": false
}
}
To get the list of record IDs from the response, execute the following snippet:
list_variable = response.toMap().get("data").toList(); for each item in list_variable { info item.get("id"); }