4

We have many schedule Reports and Dashboeds. We need to find the Recipients for all reports from code. Doing it manually will take too much time.

I have search for all objects in workbench and did not found any relevant object that can be queries to get this information.

I also tried to use Workbench Rest explorer and that also did not gave any information on recipients.

Till now i was only able to query CronJobDetail object and get the list of jobs for schedule reports. But still Report Recipients are not available via code.

Select c.Name, c.JobType, c.Id From CronJobDetail c where c.JobType = '8'
  • 1
    Assuming that as of Spring 15 the required APIs aren't present to access this information you may need to consider the API Of Last Resort - screen scrapping. Things might get ugly thought as it uses the _CONFIRMATIONTOKEN in a POST request to access the report users. – Daniel Ballinger Mar 12 '15 at 9:44
  • Yeah that would be my last resort ... wire code to do screen scrapping and find out the recipients . – AtulRajguru9 Mar 12 '15 at 10:37
2
+50

Update Spring '17.

I haven't gone through it in great detail, but there is not the Analytics API. Maybe try the Analytics Notification resource


Update from Arun V (Product Management, Analytics @ Salesforce) via twitter:

No APIs for scheduled reports yet!
Source

Assuming that as of Spring 15 the required APIs aren't present to access this information you may need to consider the API Of Last Resort - screen scrapping. Please be aware that screen scraping comes with a number of risks. Most importantly, Salesforce may alter the function and HTML content of the page at any time and cause your scrapping to break. Don't use it for anything critical.

Things might get ugly thought as it uses the _CONFIRMATIONTOKEN in a POST request to access the report users.

You would need to first GET request the page that returns the _CONFIRMATIONTOKEN then form the required POST request to get the current report recipients. It will take a bit of monitoring of the actual requests being made by the UI, but it should be possible.


There is an example of retrieving confirmation tokens via Apex in AuditForce: Native surfacing of the Salesforce Setup Audit Trail.

The steps to screen scrap will be:

  1. Send a GET request to the Reports details page: E.g. https://na5.salesforce.com/00O700000000001
  2. Extract the value of the _CONFIRMATIONTOKEN hidden input.
  3. Determine the POST request that gets created when you push Schedule Future Runs.... It will be something like setting the nav form variable to schedule. The browsers developer tools will show you the request.
  4. Send the POST request with the required Form data. Include the Session ID cookie in the request (sid).
  5. Extract the HTML from the page that represent the Email Report Recipients. It looks like you want to find the select with the id schedule_duel_select_1

enter image description here

  • If have any exprince in this area can you please provide some sample code for this? – AtulRajguru9 Mar 16 '15 at 4:46
  • I'll try invoking @metadaddy, as he has an aversion to screen scraping Salesforce data (and rightly so to). He may have a better idea. – Daniel Ballinger Mar 16 '15 at 7:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.