function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
girbot56girbot56 

SQOL - Count Dupicate Products

Hi, Is it possible to write a query for the below? Show certain fields from the Opportunity Line Item, grouping by the Account Name, where that Product appears more than once under the Account. Just to clarify I have two custom formula fields on the Opportunity Line Item that pulls the Account Id/Name and Product Id, these are the two that I have been trying to use to achieve the above I beleive there is a limitation on using formula fields with GROUP BY but I am happy to amend to a text field and workflow rule if necessary, but I would appreciate some guidance on if the above query is possible first? Thanks in advance :)
Ashish_SFDCAshish_SFDC

Hi Girbot,

 

You can create a Summary Report with Report Type: Opportunities with Products where you can add the Columns below,
Account ID or Account Name
Opportunity ID or Opportunity Name and the Quantity.

Product Name which will display the total of Products quantity.

 

Regards,
Ashish

girbot56girbot56
Thanks for the reply but I have already tried similiar but unfortunately there are more than 2,000 records so cannot all be shown. A SOQL would be great for ease of use in the future but I'm not sure from my limited experience of SOQL is if it is possible.
Ashish_SFDCAshish_SFDC

Hi Girbot,

 

Try this if it helps, 

 

You are using SOAP APIs, where by default the max records returned are 500, which could be uplifted to 2000.

 

Best would be to use "queryMore" to load the records. Here is a post from salesforce docs with good code samples for the same:

 

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_querymore.htm

 

http://salesforce.stackexchange.com/questions/13485/return-more-than-2000-records-soql

 

Regards, 

Ashish