Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Salesforce 主明细关系明细值未显示_Salesforce_Apex Code_Visualforce - Fatal编程技术网

Salesforce 主明细关系明细值未显示

Salesforce 主明细关系明细值未显示,salesforce,apex-code,visualforce,Salesforce,Apex Code,Visualforce,嗨,我正在写一个视觉力,它的代码是 <apex:page id="pageId" controller="FieldSetDemonstration"> <apex:form id="formId"> <apex:pageblock id="pbId"> <apex:pageblocksection columns="1" id="pbsIs"> <apex:repeat va

嗨,我正在写一个视觉力,它的代码是

 <apex:page id="pageId" controller="FieldSetDemonstration">  
<apex:form id="formId">  
    <apex:pageblock id="pbId">  
        <apex:pageblocksection columns="1" id="pbsIs">  
            <apex:repeat value="{!Fields}" var="f">  
                <apex:outputLabel value="{!merch[f]}">  
            </apex:outputLabel></apex:repeat>  
        </apex:pageblocksection>  
    </apex:pageblock>  
</apex:form>  
</apex:page>

控制器代码为 公共课堂现场演示{

public Resource__c merch { get; set; }

public FieldSetDemonstration() {
    this.merch = getMerchandise();
}

public List<Schema.FieldSetMember> getFields() {
    return SObjectType.Resource__c.FieldSets.Hello2.getFields();
}

private Resource__c getMerchandise() {
    String query = 'SELECT ';
    for(Schema.FieldSetMember f : this.getFields()) {
        query += f.getFieldPath() + ', ';
    }
    query += 'Id  FROM Resource__c LIMIT 1';
    System.debug('Hello world debug log');
   Resource__c res= Database.query(query);
   Object re=res.Resource_Position__r.Name;
公共资源{get;set;} 公共现场演示(){ this.merch=getMerchance(); } 公共列表getFields(){ 返回SObjectType.Resource_uc.fieldset.Hello2.getFields(); } 私有资源\uuuu c get商品(){ 字符串查询='选择'; 对于(Schema.FieldSetMember f:this.getFields()){ query+=f.getFieldPath()+','; } 查询+='Id FROM Resource_u_c LIMIT 1'; debug(“Hello world调试日志”); Resource\uu c res=Database.query(查询); Object re=res.Resource\u Position\u r.Name; debug('helloworld调试日志'+''+res); System.debug('Hello World1'+查询); 返回res; } }

和系统日志值为

12:28:55.052(52125000)|用户|调试|[22]|调试|你好世界调试日志资源|

12:28:55.052(52157000)| USER|u DEBUG |[23]| DEBUG | Hello World1选择Resource_Position_r.CreatedById,Resource_Position_c,Name,Owner.Email,Resource_Position_r.Name,Resource_c LIMIT 1中的Id

在资源位置和资源位置之间有一个主-细节关系 代码中的Hello2是一个字段集 其中包含以下字段

资源位置>资源位置名称

资源位置

资源名称

我面临的问题不是显示所有三个字段的值 1.资源位置>资源位置名称 2.资源状况 3.资源名称 它只显示资源名称的值 没有价值

资源位置>资源位置名称

资源位置

但是我把一个Resource_Position_c对象和Resource_c对象联系起来,为什么它没有显示这两个字段的值,任何人都可以帮助解决这个问题


如果我在fieldset hello2 Owner ID>E-mail中再添加一个字段,那么它在visualforce页面中显示正确的所有者电子邮件地址,唯一的问题是来自此customobject的字段名。任何人都可以告诉我为什么它没有为Resource\u Position\u c.name字段赋予值是否实际查询了关系(
System.debug(query)
)?这样,您就可以知道这是一个显示问题还是一个查询必须以不同的方式构造。@我打开调试日志,查询结果是01:10:59:064变量分配[7]| res |{“serId”:1,“value”:{“Name”:“Hello Bro”,“Owner”:{“serId”:2,“value”:{“Email”:developercontest@gma(6个以上)…“,“Id:”0059000001V6Loaac“}}},“所有者Id”:“0059000001V6LOAAC”,“Id:“A0490000023 JI7AAM”}|0x7f6902ef,查询为SELECT Resource\u Position\u r.CreatedById,Resource\u Position\u c,Name,Owner.Email,Resource\u Position\u r.Name,Id FROM Resource\u c LIMIT 1因此它不是一个显示问题,我认为它的查询问题可能是正确的。如果它是错误的,请建议应该是什么query@eyescream你能告诉我是什么吗(6更多)在电子邮件中:developercontest@gma(6个以上)调试日志中的这(6个以上)是il.com 6个字符还是其他东西?请告诉我是的,我认为这是完整的电子邮件(我不喜欢“开发人员控制台”,正是因为这些东西…使用调试日志的原始视图或“oldschool”-在安装程序中打开调试日志?