Salesforce 如何在SOQL中检索父对象字段值以在VF页面中显示
我是SFDC的新手,努力通过子对象上的SOQL查询检索父对象字段。 我有两个对象,即Opportunity和Scope,其中Scope具有对Opportunity的查找 这是我在Controller中编写的查询 ScopeController.cls:Salesforce 如何在SOQL中检索父对象字段值以在VF页面中显示,salesforce,visualforce,soql,Salesforce,Visualforce,Soql,我是SFDC的新手,努力通过子对象上的SOQL查询检索父对象字段。 我有两个对象,即Opportunity和Scope,其中Scope具有对Opportunity的查找 这是我在Controller中编写的查询 ScopeController.cls: List<Scope> scopeList=[Select id,Name,ScopeValue__c,Opportunity__c,Opportunity__r.opAmount__c from Scope__c]; Syst
List<Scope> scopeList=[Select id,Name,ScopeValue__c,Opportunity__c,Opportunity__r.opAmount__c from Scope__c];
System.debug('scopeList : '+scopeList);
List scopeList=[从范围中选择id、名称、范围值、机会、机会];
System.debug('scopeList:'+scopeList);
访问下面VF页面中scopeList的值
范围页面:
<apex:repeat value="{!scopeList}" var="s">
<tr>
<td>{!s.Name}</td>
<td>{!s.ScopeValue__c}</td>
<td>{!s.Opportunity__c}</td>
<td>{!s.Opportunity__r.opAmount__c}</td>
</tr>
</apex:repeat>
{!s.Name}
{!s.ScopeValue__c}
{
{!s.Opportunity\u r.opAmount\u c}
但在上面的VF页面中,无法显示s.Opportunity\uu r.opAmount\uu c的值,它是空的。我在Controller中调试过,SOQL查询本身没有检索到“Opportunity\uu r.opAmount\uu c”的值,因此在VF页面中显示为空。一个原因可能是您的配置文件没有访问此字段的权限(Opportunity\uu r.opAmount\uu c) 我觉得这个问题很好。您是否在标准布局上看到此值。您的个人资料有权访问此字段吗