您的位置:首页 > 其它

salesforce 零基础学习(五十)自定义View或者List以及查看系统原来的View或者List

2016-11-10 09:29 453 查看
salesforce给我们提供了标准的页面,比如标准的页面包括标准的列表和标准的详细页视图。有的时候我们想要自定义视图,比如做一个项目的时候不希望使用者直接通过ID查看到标准的详细页,而是跳转到指定处理过的详细页,这个时候做法如下:

1 <apex:page standardController="Company_Info__c" extensions="CompanyDetailController">
2     <apex:pageBlock >
3         <apex:panelGrid columns="2" style="width:100%;" rendered="{!companyInfo == null}">
4             不存在此ID对应的记录,请重新检查相关ID
5         </apex:panelGrid>
6         <apex:panelGrid columns="2" style="width:100%;" rendered="{!companyInfo != null}">
7             <apex:outputLabel value="{!$ObjectType.Company_Info__c.Fields.Company_Code_Unique__c.Label}" style="color: #830051;line-height: 24px;"/>
8             <apex:outputLabel value="{!companyInfo.Company_Code_Unique__c}"/>
9
10             <apex:outputLabel value="{!$ObjectType.Company_Info__c.Fields.Company_Name__c.Label}" style="color: #830051;line-height: 24px;"/>
11             <apex:outputLabel value="{!companyInfo.Company_Name__c}"/>
12
13             <apex:outputLabel value="{!$ObjectType.Company_Info__c.Fields.Company_Phone__c.Label}" style="color: #830051;line-height: 24px;"/>
14             <apex:outputLabel value="{!companyInfo.Company_Phone__c}"/>
15
16             <apex:outputLabel value="{!$ObjectType.Company_Info__c.Fields.Company_Place__c.Label}" style="color: #830051;line-height: 24px;"/>
17             <apex:outputLabel value="{!companyInfo.Company_Place__c}"/>
18
19             <apex:outputLabel value="{!$ObjectType.Company_Info__c.Fields.Company_Type__c.Label}" style="color: #830051;line-height: 24px;"/>
20             <apex:outputLabel value="{!companyInfo.Company_Type__c}"/>
21
22             <apex:outputLabel value="{!$ObjectType.Company_Info__c.Fields.Employees_Number__c.Label}" style="color: #830051;line-height: 24px;"/>
23             <apex:outputLabel value="{!companyInfo.Employees_Number__c}"/>
24         </apex:panelGrid>
25     </apex:pageBlock>
26 </apex:page>


CompanyDetailPage
3.修改Company Info这个object的view,修改成override with visualforce Page



4.显示效果:当在窗口输入:https://c.ap2.visual.force.com/a032800000JG8c0AAD访问以后会自动跳转到
https://c.ap2.visual.force.com/apex/CompanyDetailPage?id=a032800000JG8c0AAD&sfdc.override=1


通过以上几步可以实现自定义view的操作。那么问题来了,如果我是admin,我想通过这条记录ID,查看他的原始信息,查看他的审批流程,但是这条记录的view视图已经被override了怎么办,可以采用此种操作进行查看原始的记录view视图。
https://ap2.salesforce.com/a032800000JG8c0AAD?nooverride=1 此种访问便可以显示原来的view视图



总结:此篇主要想强调的是view视图被override以后想要看原始的视图方式,相信很多人都会,在此写成一篇博客,方便自己以后忘记时查看,此篇如果有错误的地方欢迎指正,有不懂的地方欢迎留言。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐