1. I'm new to Saleforce SOQL

  2. Just installed FORCE.com Explorer to create and test quires which I will using on a third-party Dashbboard that supports SOQL.

What I'm doing:

  1. I'm trying to create a query that gives me a count of leads grouped by product. So far I have managed.

  2. However the product field is an Id. I have been told that the relationships we have between lead and product are custom so using the standard relationship won't work.

  3. I'm having trouble find the right resource that can help me solve this issue. Would appreciate some guidance on the matter.

2 Answers 2


Your query group by would be (IIRC you can group by via relationships):

group by Product__r.name

Custom Relationships are appended with __r.

Custom Objects / fields are appended with __c.

As for documentation it is all in the Understanding Relationship Names, Custom Objects, and Custom Fields

  • Issue has been sorted thanks for your feedback Eric
    – user27574
    Commented Jan 7, 2016 at 11:32
  • @user27574 - If you want to thank me up vote the answer. If this helped solve your question, please mark it as accepted so other benefit from a question with an accepted answer
    – Eric
    Commented Jan 7, 2016 at 13:26

Looking into the properties of a specific field one will be able to see the exact name defined for the relationship.

Ex FieldName__r.FieldName__c

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .