1

I have a Visual Force page that I created that contains a dynamic pick list field I want to add to a page layout. The VF page uses a standard controller for "Account" and has an extension. I am having an issue with the dynamic pick list field displaying on the Account page when I add it to the page layout.

VF Page:

<apex:page standardController="Account" extensions="Account_QuoteTemplatesExtension" showHeader="false" sidebar="false">
    <apex:detail />
    <apex:form >
        <apex:PageBlock mode="edit">
            <apex:PageBlockSection title="Quote Template Selection" columns="1">
                <apex:PageBlockSectionItem >

                    <!-- Label for picklist -->
                    <apex:outputLabel value="Quote Template" for="quoteTemplates" />
                    <!-- Dynamic picklist of values (quote templates) -->
                    <apex:selectList value="{!selectedTemplate}" size="1" id="quoteTemplates">
                        <apex:selectOptions value="{!TemplateOptions}" />
                    </apex:selectList>

                </apex:PageBlockSectionItem>
            </apex:PageBlockSection>
        </apex:PageBlock>
    </apex:form>
</apex:page>

Apex Class Controller:

global with sharing class Account_QuoteTemplatesExtension {

private final ApexPages.StandardController controller;
private final Account record;
private final Id recordId;

public String selectedTemplate {get; set;}

public Account_QuoteTemplatesExtension (ApexPages.StandardController stdController) {
    this.controller = stdController;
    this.recordId   = this.controller.getId();
    this.record     = [SELECT id, name FROM Account WHERE Id = :this.recordId LIMIT 1];
}

// Returns list of quote template options
public List<SelectOption> getTemplateOptions() {
    // Initiate option list
    List<SelectOption> tempOptions = new List<SelectOption>();
    // Get all quote templates from metadata
    List<Quote_Template__mdt> quoteTemplates = [SELECT MasterLabel, Template_Id__c FROM Quote_Template__mdt];
    // Add all options to select option list
    for (Quote_Template__mdt temp : quoteTemplates) {
        tempOptions.add(new SelectOption(temp.Template_ID__c,temp.MasterLabel));
    } 
    return tempOptions;   
}

}

I have added the VF page in a section called "Quote Template" enter image description here

But the section renders blank on the Account record page enter image description here

The VF page renders fine in the preview, but will not show up embedded on the page layout. Preview

Is this an issue with my controller?

  • 2
    Also...Why are you embedding the <apex:detail />...It doesn't make any sense to nest like that. – Adrian Larson Aug 29 '16 at 19:49
  • 1
    I would strip out all content at first and then replace it with <apex:outputText value="Hello World" /> or some such. If it renders, add tags back in incrementally until it breaks. Also attributes like mode="edit" could be the cause. If that pared down page still doesn't render, something else is up. – Adrian Larson Aug 29 '16 at 19:53
  • 1
    I have tried with the following taking out additional attributes and tags: <apex:page standardController="Account"> <p> Hello World! </p> </apex:page> but the page still renders blank on the page layout. – jalamak Aug 29 '16 at 20:21
  • 1
    I've checked multiple times to make sure I am using the right page and I have tried creating a new one as well. I've been getting messages saying 'Your browser privacy settings have prevented this page from showing some Visualforce content. To display this content you need to change your browser privacy settings to allow "Third Party" cookies from the domain c.cs44.visual.force.com. Alternatively, if your browser is Internet Explorer, you can add c.cs44.visual.force.com to your trusted sites list in the security options page.' – jalamak Aug 29 '16 at 23:02
  • 1
    It looks like it worked! But I have to click on the button that takes me to the VF page first. After I click that button to get to the link, it renders on the page layout page. – jalamak Aug 29 '16 at 23:34
1

I think this may actually be related to bugs in Chrome's build for version 52. Try installing version 53 (which is still in Beta) and you may resolve those security issues.

0

If your referring any field in visual force page please check that particular field permission is enabled for logged in user or not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.