You need to sign in to do that
Don't have an account?
Jonathan Lord
Use result of one SOQL query for another
Hi,
I have a requirement to set the Pricebook on the Opportunity but want to be able to do it with one SOQL query if possible.
From the Opportunity I can get the Campaign.PFC_Product_Name__c Id which I then want to be able to use to query the Pricebook object to get the Id for that PFC_Proudct__c.
Opportunity o = [SELECT Id, Campaign.PFC_Product_Name__c FROM Opportunity WHERE Id = '0063B000006bxt6QAA'];
Pricebook2 pb = [SELECT Id, Name FROM Pricebook2 WHERE PFC_Product__c = :o.Campaign.PFC_Product_Name__c];
Any help would be appreciated.
Thanks,
Jonno
I have a requirement to set the Pricebook on the Opportunity but want to be able to do it with one SOQL query if possible.
From the Opportunity I can get the Campaign.PFC_Product_Name__c Id which I then want to be able to use to query the Pricebook object to get the Id for that PFC_Proudct__c.
Opportunity o = [SELECT Id, Campaign.PFC_Product_Name__c FROM Opportunity WHERE Id = '0063B000006bxt6QAA'];
Pricebook2 pb = [SELECT Id, Name FROM Pricebook2 WHERE PFC_Product__c = :o.Campaign.PFC_Product_Name__c];
Any help would be appreciated.
Thanks,
Jonno
Pricebook2 pb = [SELECT Id, Name FROM Pricebook2 WHERE PFC_Product__c in (SELECT Campaign.PFC_Product_Name__c FROM Opportunity WHERE Id = '0063B000006bxt6QAA' ) ];