I am new to salesforce tech. Help me .

As I m using both standard Controller and extension I cant get the values from custom controller(PDFGeneration). If I dont give getMethod() to return value to the page, I m getting error like,

"Cannot find ContactStandardController.name"

Can I get the value of setString in this VFpage.

Please find my code below

My Apexpage

<apex:page renderAs="PDF" standardController="Contact" extensions="PDFGeneration" recordSetVar="contacts">
<apex:outputLabel >Email Attachment pdf sent successfully</apex:outputLabel>
<apex:pageBlock >
<apex:pageBlockSection >
<apex:pageBlockTable value="{!contacts}" var="i">
<apex:column headerValue="Contact Name">
<apex:outputField value="{!i.Name}"/>
<apex:column headerValue="Account Name">
<apex:outputField value="{!i.Account.name}"/>

<apex:pageBlockTable value="{!setString}" var="j">

<apex:column headerValue="Id">
<apex:outputText value="{!j.name}"/>


global class PDFGeneration

Set<String> setString;
          public PDFGeneration(ApexPages.StandardController cont) 
         { }

    public PDFGeneration(ApexPages.StandardSetController con) 
        List<Candidate__c> listCandidate=[Select id, name, First_Name__c, Last_Name__c,Mobile_Number__c, E_mail__c from Candidate__c];

        setString  =new Set<String>{String.valueOf(listCandidate)};

    public Set<String> getSetString()
    return setString;

public void generatePDF()
Messaging.SingleEmailMessage email=new Messaging.SingleEmailMessage();

1 Answer 1


Your setString property returns a set of strings not a set of objects that have a name property. So your table is iterating over the strings an you can just the string value directly:

<apex:outputText value="{!j}"/>

But perhaps what you are trying to do is this:

global class PDFGeneration
      public PDFGeneration(ApexPages.StandardController sc) {
      public List<Candidate__c> getSetString() {
          return [Select id, name, First_Name__c, Last_Name__c,Mobile_Number__c, E_mail__c
                  from Candidate__c];

in which case {!j.name} would work.

  • Thank you so much Keith C. That error got resolved. But when I m trying to preview the VFPage, I got an error like "Unknown constructor 'PDFGeneration.PDFGeneration()'". Please help me.
    – Anitha J J
    Nov 27, 2014 at 11:42
  • 1
    Using ApexPages.StandardSetController as the constructor argument instead of ApexPages.StandardController may fix that. But this is not an interactive help site. So work on fixing the problem yourself - ask a colleague , Google etc - and if after some time you are still stuck post a new question here with the current version of your code and page.
    – Keith C
    Nov 27, 2014 at 11:47

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.