• Jasmine Fortich
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
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 Code:
<apex:page standardController="Account" extensions="Account_QuoteTemplatesExtension" showHeader="false" sidebar="false">
    <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 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 added the VF page in a section on the page layout like so:
Screenshot of customized page layout

But the page layout section remains blank
Blank section on page layout

The preview renders properly, but it will not display on the page layout
Preview of VF Page

I have already checked the security settings for the VF Page and have enabled access for System Administrator, which is the profile I am using. I have also tried to render a very simple VF page with the following code:
<apex:page standardController="Account">
        <apex:outputText value="Hello World" />
</apex:page>
But it still leaves the page layout blank-- I'm not sure where to go from here. Any suggestions?




 
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 Code:
<apex:page standardController="Account" extensions="Account_QuoteTemplatesExtension" showHeader="false" sidebar="false">
    <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 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 added the VF page in a section on the page layout like so:
Screenshot of customized page layout

But the page layout section remains blank
Blank section on page layout

The preview renders properly, but it will not display on the page layout
Preview of VF Page

I have already checked the security settings for the VF Page and have enabled access for System Administrator, which is the profile I am using. I have also tried to render a very simple VF page with the following code:
<apex:page standardController="Account">
        <apex:outputText value="Hello World" />
</apex:page>
But it still leaves the page layout blank-- I'm not sure where to go from here. Any suggestions?