Choose where you’d like to start

Get Related Records from Zoho FSM

Description

You can fetch related information (Notes, Tasks, Contacts, etc.) about a record using the zoho.fsm.getRelatedRecords() Deluge task.

Syntax

<response> = zoho.fsm.getRelatedRecords(<relation_name>, <parent_module_name>, <record_id>, <page>, <per_page>, <optional_data_map>, <connection>);

where:

ParamsData typeDescription

<response> 

KEY-VALUE

is the response returned by Zoho FSM.

<relation_name>

TEXT

is the API name of the related list whose entries you want to fetch.

Note: You can find the supported modules in Zoho FSM API document.

<parent_module_name> 

TEXT

is the API name of the module whose related list information you want to fetch.

Note: You can find the supported modules in Zoho FSM API document.

<record_id> 

NUMBER

is the unique ID of the record you want to retrieve.

Note: Learn how to fetch the ID of a record after creating or fetching it.

<page>

(optional)

NUMBER

indicates the page number from which you want to retrieve records.

Default value: 1

<per_page>

(optional)

NUMBER

indicates the number of records that need to be fetched per page.

Default value: 200

<optional_data_map>

(optional)

KEY-VALUE

is a parameter to pass any additional values in the Zoho FSM API. To ignore querying, provide an empty map. For example: {"":""}

Note: Currently there is no extra parameter supported by the Zoho FSM - Get Related Records API

<connection>

(optional)

TEXT

is the name of the connection created for Zoho FSM.

Note: Add relevant scopes as mentioned in Zoho FSM API.

Example

The following script fetches all the Work Orders associated to the Request with ID - 23033XXXXXXXXXXXXXX in Zoho FSM.

 emptyMap = Map();
 
 response = zoho.fsm.getRelatedRecords("Work_Orders", "Requests", 23033XXXXXXXXXXXXXX​, 1​, 200​, emptyMap​, "fsm_connection"​);

where:

response
is the KEY-VALUE response returned by Zoho FSM.
"Work_Orders"
is the TEXT that represents the API name of the Zoho FSM module from which the record has to be fetched.
"Requests"
is the TEXT that represents the parent module to which the submodule belongs.

Response Format

The following is a sample response returned when related records are fetched:

{
  "data": [
    {
      "Owner": {
        "name": "Mary Cooper",
        "id": "1439000000161001",
        "email": "shawn@zylker.com"
      },
      "Estimate": null,
      "Company": {
        "name": "ABC Services",
        "id": "1439000000161212"
      },
      "Email": "betty@zylker.com",
      "Discount": 0,
      "$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,
      "Cancelled_Or_Terminated_Time": null,
      "Dispatcher": {
        "name": "Mary Cooper",
        "id": "1439000000161001"
      },
      "Name": "WO9",
      "Tax_Amount": 7,
      "Invalid_Data": false,
      "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_City": "East Moline",
        "Service_Country": "United States"
      },
      "Asset": null,
      "id": "1439000000185184",
      "Discount_Type": "Currency",
      "Status": "New",
      "Grand_Total": 107,
      "Territory": {
        "name": "Colona",
        "id": "1439000000161185"
      },
      "Modified_Time": "2022-05-16T00:48:59-07:00",
      "Due_Date": null,
      "Adjustment": 0,
      "Priority": "Medium",
      "Created_Time": "2022-05-13T00:51:11-07:00",
      "Request": {
        "name": "REQ1",
        "id": "1439000000185139"
      },
      "Sub_Total": 100,
      "$editable": true,
      "Completed_Time": null,
      "Billing_Status": "-None-",
      "$permissions": {
        "read": true,
        "edit": true,
        "delete": true
      },
      "Contact": {
        "name": "Lucy Robins",
        "id": "1439000000161222"
      },
      "Type": "Service",
      "Parent_Work_Order": 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": 200,
    "count": 1,
    "page": 1,
    "more_records": false
  }
}

To get the list of record IDs from the response, execute the following snippet:

 records = response.toMap().get("data");
 for each rec in records
 {
  info rec.get("id");
 }

Related Links

Get Started Now

Execute