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!
OppId= [SELECT Opportunity_Id__c FROM Order__c WHERE Id = : orderID LIMIT 1].Opportunity_ID__c;