+ Start a Discussion

Create Report in Test Class


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
Here is the documentation about creating a report with a couple examples.
Matt SmelserMatt Smelser
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

just realized that and delete my reply, sorry

but is it possible to retrieve built-in reports?