【问题标题】:create a child visual force page创建子视觉力页面
【发布时间】:2012-09-24 18:04:50
【问题描述】:

我在联系人记录中有一个名为“Gift_c”的自定义对象。我想用 visualforce 页面替换标准的“Gift_c”页面,以便我可以有选择地隐藏某些字段。

一切都非常简单。

<apex:page standardController="Gift__c" showHeader="true"   >
<apex:form >      
<apex:pageBlock title="" mode="Edit">
    <apex:pageMessages />
    <apex:pageBlockButtons >
        <apex:commandButton value="Save" action="{!save}"/>
        <apex:commandButton value="Cancel" action="{!cancel}"/>               
    </apex:pageBlockButtons>
    <apex:pageBlockSection title="Basic Information" columns="1">
        <apex:inputField value="{!Gift__c.Contact__c}"/>
        <apex:inputField value="{!Gift__c.GiftAmount__c}"/>
    </apex:pageBlockSection>        
</apex:pageBlock>
</apex:form>

挑战:

通常,当您在联系人中并且我单击“新礼物”按钮时,礼物中的 Contact_c 字段_c 对象会填充为我刚刚来自的人。如何确保在新的 Visual Force 页面上仍然发生这种情况

【问题讨论】:

    标签: salesforce visualforce


    【解决方案1】:

    实际上,只要您覆盖“新建/编辑”按钮以指向新页面,此功能就会开箱即用。

    【讨论】:

      【解决方案2】:

      有所谓的 lkid hack。这是一个未记录的功能,即父级的值作为 GET 参数从相关列表上的“新建”按钮传递。所以你可以通过这种方式提取参数,但人们普遍认为这是一个非常脆弱的解决方案。

      或者这里发布了一个非常简洁的解决方案:hack-to-find-field-ids-allows-a-default-ui-new-page-to-be-pre-populated

      此解决方案是屏幕抓取页面 html 中所有 lkid 值的标准编辑页面。这可能有一天会停止工作的原因有很多,但它可能比对 get 参数进行逆向工程更强大。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-07-23
        • 1970-01-01
        • 2011-04-23
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多