getRelatedRecords Method

getRelatedRecords Method

Purpose

You can use the getRelatedRecords method to fetch related records.

For example: You can fetch Leads related to a Campaign or fetch tasks related to an Account.

Request URL

XML Format:
https://crm.zoho.com/crm/private/xml/Leads/getRelatedRecords?authtoken=Auth Token&scope=crmapi&id=Record ID&parentModule=Module Name

JSON Format:
https://crm.zoho.com/crm/private/json/Leads/getRelatedRecords?authtoken=Auth Token&scope=crmapi&id=Record ID&parentModule=Module Name

Request Parameters

Parameter Data Type Description
authtoken* String Encrypted alphanumeric string to authenticate your Zoho credentials.
scope* String Specify the value as crmapi
parentModule* String Module for which you want to fetch the related records
Example: If you want to fetch Leads related to a Campaign, then Campaigns is your parent module.
id* Integer The id of the record for which you want to fetch related records
newFormat Integer newFormat=1: To exclude fields with "null" values while inserting data from your CRM account.
newFormat=2:To include fields with "null" values while inserting data from your CRM account.
fromIndex Integer Default value - 1
toIndex Integer Default value - 20
Maximum range value - 200
[Maximum range value = toIndex - fromIndex]

* - Mandatory parameter

Note:

  • The getRelatedRecords method does not support Custom Lookup fields.

Related Lists Supported

The getRelatedRecords method supports all modules and their respective Related Lists except Emails, Competitors and Integrations (Zoho Support, Zoho Projects, etc)

Examples

To fetch Leads related to a Campaign ( with id 121212121 )

URL Format:

https://crm.zoho.com/crm/private/json/Leads/getRelatedRecords?newFormat=1&authtoken=sbdjEDBDJ1323&scope=crmapi&parentModule=Campaigns&id=121212121

To fetch the Stage History related to a Deal

URL Format:

https://crm.zoho.com/crm/private/xml/PotStageHistory/getRelatedRecords?authtoken=Auth Token&scope=crmapi&id=468939000000054013&parentModule=Deals

To fetch Contact Roles related to a Deal

URL Format:

https://crm.zoho.com/crm/private/xml/ContactRoles/getRelatedRecords?authtoken=Auth Token&scope=crmapi
&id=468939000000054013&parentModule=Deals

To view files attached to a record

URL Format:

https://crm.zoho.com/crm/private/xml/Attachments/getRelatedRecords?authtoken=Your Auth Token&newFormat=1&scope=crmapi&parentModule=Leads&id=508020000000957321

Sample Response

<response uri="/crm/private/xml/Attachments/getRelatedRecords">
<result>
<Attachments>
<row no="1">
<FL val="id">5080200000005483628</FL>
<FL val="File Name">
<![CDATA[ wallpaper.jpeg ]]>
</FL>
<FL val="Size">
<![CDATA[ 175662 bytes ]]>
</FL>
<FL val="Modified Time">
<![CDATA[ 2012-07-03 14:58:36 ]]>
</FL>
<FL val="SMOWNERID">508020000000065849</FL>
<FL val="Attached By">
<![CDATA[ charles stone]]>
</FL>
</row>
<row no="2">
<FL val="id">5080200000000906253</FL>
<FL val="File Name">
<![CDATA[ image.jpeg ]]>
</FL>
<FL val="Size">
<![CDATA[ 8550 bytes ]]>
</FL>
<FL val="Modified Time">
<![CDATA[ 2012-07-03 14:58:35 ]]>
</FL>
<FL val="SMOWNERID">508020000000065849</FL>
<FL val="Attached By">
<![CDATA[ charles stone]]>
</FL>
</row>
<row no="3">
<FL val="id">5080200000009873561</FL>
<FL val="File Name">
<![CDATA[ sample-image.jpg ]]>
</FL>
<FL val="Size">
<![CDATA[ 114775 bytes ]]>
</FL>
<FL val="Modified Time">
<![CDATA[ 2012-07-03 14:58:35 ]]>
</FL>
<FL val="SMOWNERID">508020000000065849</FL>
<FL val="Attached By">
<![CDATA[ charles stone]]>
</FL>
</row>
<row no="4">
<FL val="id">5080200000001928374</FL>
<FL val="File Name">
<![CDATA[ test-img.jpg ]]>
</FL>
<FL val="Size">
<![CDATA[ 8161 bytes ]]>
</FL>
<FL val="Modified Time">
<![CDATA[ 2012-07-03 14:58:35 ]]>
</FL>
<FL val="SMOWNERID">508020000000065849</FL>
<FL val="Attached By">
<![CDATA[ charles stone]]>
</FL>
</row>
</Attachments>
</result>
</response>

To fetch notes under a record

URL Format:

https://crm.zoho.com/crm/private/xml/Notes/getRelatedRecords?authtoken=<Your Authtoken>&scope=crmapi&id=RECORD_ID&parentModule=Module Name

Sample Response

<responseuri="/crm/private/xml/Notes/getRelatedRecords">
<result>
<Notes>
<rowno="1">
<FLval="id">5080200000005483628</FL>
<FLval="Note Content">
<![CDATA[ New note under the record ]]>
</FL>
<FLval="SMOWNERID">508020000000065849</FL>
<FLval="Owner Name">
<![CDATA[ James ]]>
</FL>
<FLval="SMCREATORID">508020000000065849</FL>
<FLval="Created By">
<![CDATA[ James ]]>
</FL>
<FLval="Created Time">
<![CDATA[ 2012-12-12 05:00:00 ]]>
</FL>
<FLval="MODIFIEDBY">508020000000065849</FL>
<FLval="Modified By">
<![CDATA[ James ]]>
</FL>
<FLval="Modified Time">
<![CDATA[ 2012-12-12 05:00:00 ]]>
</FL>
<FLval="ISVOICENOTES">
<![CDATA[ false ]]>
</FL>

</row>
</Notes>
</result>
</response>

    • Related Articles

    • getRelatedRecords Method - Comparison

      Purpose To retrieve records related to a primary module. Request URL Version 1.0: https://crm.zoho.com/crm/private/xml/Contacts/getRelatedRecords?authtoken=AuthToken&scope=crmapi&id=Record ID&parentModule=Module Name Version 2.0: URL: ...
    • deleteRecords Method

      Table of Contents Purpose Request URL Request Parameters Example Purpose You can use this method to delete the selected record (you must specify unique ID of the record) and move to the recycle bin. Note: This method is availablefor all modules. ...
    • downloadPhoto Method

       Purpose You can use this method to download the photos of Leads or Contacts.  Request URL XML Format: For Leads: https://crm.zoho.com/crm/private/xml/Leads/downloadPhoto?authtoken=Auth Token&scope=crmapi&id=RecordID For Contacts: ...
    • searchRecords Method

       Purpose You can use the searchRecords method to get the list of records that meet your search criteria.  Request URL XML Format: https://crm.zoho.com/crm/private/xml/Leads/searchRecords?authtoken=Auth Token&scope=crmapi&criteria=(((Last ...
    • deleteFile Method

      Purpose You can use this method to delete files attached to records. Request URL XML Format: https://crm.zoho.com/crm/private/xml/Leads/deleteFile?authtoken=Auth Token&scope=crmapi&id=Attachment Id JSON Format: ...