【发布时间】:2016-11-28 12:19:45
【问题描述】:
情况:您好,我有一个运行良好的查询,并且仅在 salesforce vf 页面中符合预期。
问题从 iframe 调用时,它返回的输出没有其父对象。
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;
}
}
VF 中的代码
< apex:page controller="myValues" >
< apex:pageBlock title="{!xx}" >
< /apex:pageBlock >
< /apex:page >
来自 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"}]}
和
iframe 的输出
{"attributes":{"type":"CKSW_BASE__Service__c","url":"/services/data/v38.0/sobjects/CKSW_BASE__Service__c/444"},"Id":"444","Name" :"xyz"}
从 Vf 页面我得到所需的完整值输出,但从我的 force.com url 中的 iframe 父对象(嵌套查询)不可用 .
但是,当我使用简单的专用查询仅调用父级时,它返回 both(iframe 和 url) 中的值 ) 地点。
为什么我的嵌套 SOQL 无法获取父对象。我在这里错过了什么??
提前致谢。 请帮忙。
Iframe 的输出
【问题讨论】:
标签: salesforce apex-code visualforce apex salesforce-communities