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
jkcjkc 

Create Report in Test Class

Hi,

I'm trying to create a sample report to use in the test class. I cannot use the SeeAllData=true because the test class is for a managed package and cannot assume that there is a sample report record available in the user's instance to use when they install it, so I really need to create a new report in the test class.

Is this even possible or a work around for this?
Matt SmelserMatt Smelser
jkc-
Here is the documentation about creating a report with a couple examples.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_analytics_test_reports.htm
 
Matt SmelserMatt Smelser
JKC-
OwnerId is a user id not a Folder Id. To look up a report in a folder you need to use the folder name. https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_report.htm
jkcjkc
Matt,

just realized that and delete my reply, sorry

but is it possible to retrieve built-in reports?