You need to sign in to do that
Don't have an account?
Lukesh Karmore
i have to write soql query on product2 any one know it
i have to write soql query on product2 , means need to fetch products releted to OpportunitylineItem .
list<OpportunityLineitem> oliList=[SELECT id,Quantity,Product2.Name,Product2.Total_Quantity__c,Product2.Available_Quantity__c FROM OpportunityLineitem
I know above way to query product. want to know below query that return same
list<Product> ProductList=[SELECT id,name, Available_Quantity__c FROM Product where -------------
hope u understand my question any one know the answer
Thank you
list<OpportunityLineitem> oliList=[SELECT id,Quantity,Product2.Name,Product2.Total_Quantity__c,Product2.Available_Quantity__c FROM OpportunityLineitem
I know above way to query product. want to know below query that return same
list<Product> ProductList=[SELECT id,name, Available_Quantity__c FROM Product where -------------
hope u understand my question any one know the answer
Thank you
Can you please elaborate the requirement and let me know what you need here?
Regards,
Priya Ranjan
The easiest way to fetch your data is the one you already stated.
Now the second query you are trying is you are trying to fetch the data from the Product2 object and the WHERE clause is used to check the condition. You cannot query the data because there is no direct relation between product2 and OpportunitylineItem.
Please mark it as the best answer if this helped you.
Thank You
Regards
Suraj Tripathi
OpportunityLineItem is not directly releted to Product2
so how to query product releted to OpportunityLineItem
i need to query on product object.
>> https://salesforce.stackexchange.com/questions/155222/fecthing-records-from-unrelated-objects-but-commonly-have-parent-object
>> https://trailblazers.salesforce.com/answers?id=9063A000000lDKXQA2
The above link shows way to write soql to fetch records from unrelated objects.
Let me know if it helps you and close your query by marking it as the best answer so that it can help others in the future.
Thanks.