You need to sign in to do that
Don't have an account?
Melliott
Help with getting a field
I have an object off called release that is a child to the account and to the opportunity. The button envokes the VF page from the opportunity and passes the opportunityid to the page on the object release. How the heck can I fill in the account field on release with the opportunity account. Driving me batty. Here is my custom controller.
public with sharing class RequestController { // steps public String requesttype {get {return 'Request';}} public String requestproduct {get {return 'Request Product';}} public String step {get; set;} public String step2 {get; set;} public RFP_Request__c Request {get; set;} // return URL private String retUrl; public RequestController() { step = requesttype; step2 = requestproduct; ID OpportunityId = ApexPages.currentPage().getParameters().get('OpportunityId'); Request = new RFP_Request__c(Opportunity__c = OpportunityId); // i know it needs to go here but how the heck do I map it... if (OpportunityId!= null) retUrl = '/' + OpportunityId; } public PageReference cancel() { if (retUrl != null) return new PageReference(retUrl); else return null; } public PageReference save() { upsert request ; return null; } public PageReference step1() { // show step 1 page return Page.requesttype; } public PageReference step2() { logic here } else return Page.requestproduct; } public PageReference step3() {//lots of logic here } private Boolean isRequestValid() { if (Request.RFP_Request__c == false && Request.RFC_Request__c == false && Request.Training_Request__c == false && Request.Service_Request__c == false ) return false; else return true; } }
It should just be a matter of querying the opportunity detail and using that.
E.g.
All Answers
It should just be a matter of querying the opportunity detail and using that.
E.g.
You just need to query the id of the account from the opportunity whose id you have.
accId=[Select AccountID from Opportunity where Id =: OpportunityId].Id;
Got it covered Bob....:smileyhappy:
Thank you. I was a long day. It worked perfectly.