You need to sign in to do that
Don't have an account?

Render Related Object Fields in VF page layout
Hey Everyone -
I have a custom object that I want to display within the opportunity page layout as it's own section. The VF page will render certain fields/sections based on how other fields are filled in. I have the object/ fields and VF page built but I cannot get the controller to work so I can place it in the Opportunity layout.
I attempted to build a list type of controller
public class Questionnaire { public Questionnaire(ApexPages.StandardController controller){} List<Questionnaire>Questions; publicList<Questionnaire>getQuestions(){ Questions=[select *FIELDS* from Questionnaire__c]; return Questions; } }
But kept receiving a compile errore for invalid public list. I just need to be able to display the fields so I'm unsure if list is even the way to go.
Obviously I'm really new to all this. Any help would be appreciated.
Thanks,
How is this object related to Opportunity, is there a lookup from the Questionaire__c object? If so, are you trying to display fields of all Questinaire__c records related to this particular Opportunity?
Exactly. There is a look up field on the questionnaire object.
Then I have a VF page that will render certain fields from the questionnaire on the oppty layout.
Thanks,
Try this
Michael - thank for the help on this. It makes a lot more sense now.
I do keep getting a compile error kicked back at lin4 column 6.
it is saying the "=" is an unexpected token in the line
this.o=(Opportunity)controller.getRecord();
any guidance you can give on that error?
Thanks,
This is what I have now:
But I'm receiving this error:
Compile Error: unexpected token: '(' at line 9 column 60
Thoughts?
I think there is a syntax mistake, try putting a space between new and List<Questionnaire__c> at line no.9
like:
List<Questionnaire__c> Questions = new List<Questionnaire__c>();
Thanks!
That fixed it and I had a few others that I found now that I understood this part. But now I'm getting this error:
Compile Error: Method does not exist or incorrect signature: controller.getRecord()
for this line:
this.o=(Opportunity)controller.getRecord();
After I get this up and running I'm going back to the workbook/cookbook and try to learn a lot more.