You need to sign in to do that
Don't have an account?
Baguiar
get value from a custom field in current page
I'm trying to get the value of a custom field that is on the current page (Account) where I have a VF page within.
I'm using this:
public class KeyL { String strname = Apexpages.currentPage().getParameters().get('Congregation_ID__C'); private List<Leadership_position_code__c> LeadersL; public List<Leadership_position_code__c> getLeadersL() { LeadersL = [ Select l.Contact__c, l.Contact__r.AccountId from Leadership_Position_Code__c l WHERE (Congregation_code__C = :strname )]; return LeadersL; } }
I can't get the value from my Custom Field (Congregation_ID__C) into the String strname.
Thanks!
B
Got it. Here is what I did:
All Answers
Can you please explain your use case in more detail? What do you mean by "current page (Account) where I have a VF page within"? Do you mean that you have embedded a custom VF page into the Account Page Layout and want to access some custom field of the Account record in your VF controller?
Thats exactly right. The Vf page is embedded in the Account page layout and I'm trying to get a custom field "Congregation_ID__C" on my controller.
Thanks!
Got it. Here is what I did:
Perfect! That's exactly the right way to query for additional fields on an SObject when embedding a VF page in a Page Layout. You only get passed in the Salesforce Record Id in the VF controller/extension. You then have to explicitly query for any additional fields using that Id (as you've done).