• Jonathan Lord
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
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