SITUATION: Hi I have a query THAT functions well & as per expectations in salesforce vf page only.
PROBLEM It returns the output without its parent object when calling from an iframe.
The code in apex:
public class showServiceHistory {
CKSW_BASE__Service__c services;
String id = ApexPages.currentPage().getParameters().get('id');
String x;
public myValues()
{
services = [SELECT id, name, (SELECT Name, Previous_Status__c, New_Status__c, Reason_Code__c, comment__c FROM Service_Status_History__r) FROM CKSW_BASE__Service__c WHERE id=:id];
}
public String getxx()
{
x=JSON.Serialize(services);
return x;
}
}
The Code In VF
< apex:page controller="myValues" >
< apex:pageBlock title="{!xx}" >
< /apex:pageBlock >
< /apex:page >
Output From Salesforce
{"attributes":{"type":"CKSW_BASE__Service__c","url":"/services/data/v38.0/sobjects/CKSW_BASE__Service__c/sss"},"Id":"s","Name":"S","Service_Status_History__r":{"totalSize":6,"done":true,"records":[{"attributes":{"type":"Service_Status_History__c","url":"/services/data/v38.0/sobjects/Service_Status_History__c/ss"},"Service__c":"asss","Id":"uu","Name":"yyy","Previous_Status__c":"xyz","New_Status__c":"y","Reason_Code__c":"xyz","Comment__c":"abc"}]}
And
Output from iframe
{"attributes":{"type":"CKSW_BASE__Service__c","url":"/services/data/v38.0/sobjects/CKSW_BASE__Service__c/444"},"Id":"444","Name":"xyz"}
From the Vf page I get the desired output with full value, but from an iframe in my force.com url the parent object (nested query) is not available.
However, when I call only parent with a simple dedicated query, it returns the value in both(iframe and url) places.
WHY MY NESTED SOQL IS UNABLE TO GET THE PARENT OBJECT. WHAT I AM MISSING HERE??
Thanks in advance. Please help.
Output from Iframe