dataMap = Map();
//Get Related List IDs
relatedListsIds = invokeurl
[
url:zohoapi_domain+"/crm/v5/"+Module+"/"+RecordId+"/"+RLModuleName+"?fields=Parent_Id"
type :GET
connection:"crm"
];
rlListData = relatedListsIds.get("data");
rlProductsList = List();
//Get Related List Data
for each record in rlListData
{
rlId = record.getJSON("id");
rlInfo = invokeurl
[
url :zohoapi_domain+"/crm/v5/+"RLModuleName+"/" + rlId
type :GET
connection:"crm"
];
rlInfoData = rlInfo.get("data").get(0);
rlMap = Map();
rlMap.put("Product_Name",rlInfoData.getJSON("Product_Name"));
rlMap.put("Product_Code",rlInfoData.getJSON("Product_Code"));
//RL Image Field
if(rlInfoData.get("Image_Upload") != null)
{
rlImageId = rlInfoData.get("Image_Upload").get(0).get("Preview_Id__s");
imageUrl = zohoapi_domain+"/crm/v2.1/__attachment_preview/" + rlImageId; //constructed image url
rlMap.put("Image_Upload",imageUrl);
}
rlProductsList.add(rlMap);
}
//Add Related List to dataMap
dataMap.put("Products",rlProductsList);
info dataMap;