You need to sign in to do that
Don't have an account?
Puneeth Kumar
SOQL query to fetch product name and product group name.
Hi All,
I want to get the the product name(in Product2 object), product group name (in Product_Hierarchy__c) from price book entry on below criteria, I have written this query which is wrong I believe. Can anyone please help me out in querying. Providing relationship btween objects from schema builder.
Select Product2.Name,
Product_Hierarchy__c.Name
From PricebookEntry, Product2, Product_Hierarchy__c
Where PricebookEntry.Pricebook2Id = ’ 01s30000000GUqhAAG’ and
PricebookEntry.Product2Id = Product2.Id and Product2.Product_Hierarchy__c = Product_Hierarchy__c.Id
Please advice.
I want to get the the product name(in Product2 object), product group name (in Product_Hierarchy__c) from price book entry on below criteria, I have written this query which is wrong I believe. Can anyone please help me out in querying. Providing relationship btween objects from schema builder.
Select Product2.Name,
Product_Hierarchy__c.Name
From PricebookEntry, Product2, Product_Hierarchy__c
Where PricebookEntry.Pricebook2Id = ’ 01s30000000GUqhAAG’ and
PricebookEntry.Product2Id = Product2.Id and Product2.Product_Hierarchy__c = Product_Hierarchy__c.Id
Please advice.
You need to get the Product Id and the Product Hierarchy id from somewhere or you cn hardcode like you did for the Pricebook. Hardcoded is not recommended though in code but if you just want to run this query for specific data then its fine.
Thanks
Anupama
Thanks for your reply. I want the query on specific Price book so I can fetch all the products name and products groups in my API. Just need to fetch a specific price book details evrytime. What might be your suggestion. Thank you.
Hi, Ishwar, from my schema I can see that as a lookup relationship.
If you just need the list of Product Names and the Product Group names then use the query below. I have removed the filter on Product and Product Group as you need all products.
Thanks
Anupama