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

SOQL query to grab accont fields
So attached is my code in my controller that is looking to pull the account data using the lookup filed called Partner__c. For some reason nothing is being pulled over. Does anyone see what i am missing this seems so simple but is causing such a headache...
public PageReference getresellerInfo (){ Account a = [SELECT Id, Name, Phone, Account.BillingStreet, Account.BillingCity, Account.BillingState, Account.BillingPostalCode, Account.BillingCountry FROM Account WHERE Id = :this.request.Partner__c]; if(this.request.Partner__c != null){ this.request.Company_Phone__c = a.Phone; this.request.Company_Address__c = a.BillingStreet; this.request.Company_City__c = a.BillingCity; this.request.Company_Postal__c = a.BillingPostalCode; this.request.Company_Country__c = a.BillingCountry; this.request.Company_State__c = a.BillingState; } system.debug('in the getresellerInfo method monkey balls 2'); return null; }
use system.debug to print the value of this.request.partner__c and see if its coming as null... from where exactly are you getting the value request.partner__c???
Hi,
Please explain from where r u getting the value of "this.request.Partner__c". As you have mention in post it seems request.partner__c contains NULL.
Partner__c is the lookup field on my VF page that pulls from account. The controller is long so here is the top of it where i declare this.request equal to the Marketing Request object which has the file Partner__c as a lookup to accounts.
yes the system debug is return back a null
Hi,
You need to make a query to get the value of Partner__c on Marketing_Request__c.
from this line
this.request = (Marketing_Request__c) controller.getSubject();
u can't get the value of Marketing_Request__c object fields. first you make a query and get the value of partner__c.
Marketing_Request__c marketingReq = [select Id,Partner__c from Marketing_Request__c where id =: request.Id];
and then use in the account query :
Account a = [SELECT Id, Name, Phone, Account.BillingStreet, Account.BillingCity, Account.BillingState, Account.BillingPostalCode, Account.BillingCountry
FROM Account
WHERE Id = :marketingReq.Partner__c];
Please let me know if you have any problem on same.If this post is helpful please give KUDOS by click on star at left.
So i added in the query and the code saved with no issues. However now when i click on my link to grab the data and pull to the screen nothing happens. Attached is the updated code as well as the VF page code that has the copy link calling the class.
VF page:
Thanks for your help by the way :D