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
dongdong 

How could I get the result by program based on the report set manually in salesforce? Urgent

Hi all,
  I want to get the result  of  report programmatically by salesforce API , Namely, I have to translate the filters that set manually in salesforce into sql , and then send query to get result.   Now I can use dataloader to connect salesforce and see the tables there. However, I don't know what each field represents for ?   For example, one of my reports has the following filters:
 

1. Case Record Type not equal to RFE,CRM4SRF   

2. Case Owner Role starts with US Support Services 

 
How Can I find which field represents  record type(String type) and which field represents Owner Role ? 
Any good solutions?   Thank you !!
werewolfwerewolf
Try downloading the Force.com Explorer and crafting a SOQL query in there.  These are simple enough criteria.
werewolfwerewolf
Actually the owner role thing may be a little tough.  If there's a reasonable number of users in the role you can do 2 queries.  The first one would be like:

Select u.Id From User u Where u.UserRole.Name like 'US Support Services%'

Take the results of that first query and put all the Ids into a comma separated list (like 005000000234,0050000000275u,00500000000284)

Now put that list into a second query

Select <case fields> from Case c where c.RecordType.Name = 'first record type' or c.RecordType.Name = 'second record type' and OwnerId in <the comma separated list you just made>
dongdong
Thank you, I will try it!!