-2

I am wanting to get the Opportunity ID from an Order object record to display the Opportunity Products on a VF page.

I am using orderID= ApexPages.currentPage().getParameters().get('ID'); to get the ID of the Order record page where the vf page is displayed.

However, I am having trouble getting the ID of the related Oppourtunity__c lookup field using OppId= [SELECT Opportunity_Id__c FROM Order__c WHERE Id = : orderID LIMIT 1].ID; , which returns the ID of the Order record instead of the Opportunity.

If I hard code the Opportunity ID the records are retrieved. Any help is much appreciated!

1
  • Was helped out by a kind redditor; posting updated code: OppId= [SELECT Opportunity_Id__c FROM Order__c WHERE Id = : orderID LIMIT 1].Opportunity_ID__c; Mar 19 at 4:23

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.