关于standardController

来源:互联网 发布:centos cuda8安装 编辑:程序博客网 时间:2024/06/08 02:38

<apex:page standardController="Report__c" extensions="FIT_ReportViewController" action="{!paramCheck}" showHeader="false" sidebar="false" standardStylesheets="false" >

 <apex:outputField value="{!Report__c.XXX}" />


如果APEX使用到但页面没有用到的字段时会报错

SObject row was retrieved via SOQL without querying the requested field: 


对应方法

private Report__c ctrlReport; 

public ReportViewController(ApexPages.StandardController sc){
        
        sc.addFields(new List<String>{ 'XXX__r.YYY__c',

                              。。。。
        });

        ctrlReport = (Report__c )sc.getRecord();        

    }

0 0
原创粉丝点击