samedi 29 août 2015

salesforce Report SOQL Access in Test Context

The count is zero, although, there are so many reports in the org. When i ran the same SOQL in anonymous i get the actual count. Since, Report is a Metadata, i would expect it to available in Test Context. Can someone throw some light on this ?

Here is my sample code:

@isTest 
private static void aTestMethod(){
    Integer count = [Select count(id) from Report];
}

As a workaround, i had to keep SeeAllData=True to make it work.

Aucun commentaire:

Enregistrer un commentaire