1

I'm currently in the process of troubleshooting (will be updating as I go along) but as it stands, I can't seem to create analytics notifications as other users, only as myself.

{
  "thresholds": [
    {
      "type": "condition",
      "conditions": [
        { "value": "10.0", "operation": "greaterThan", "colName": "RowCount" }
      ],
      "actions": [
        { "type": "sendEmail", "configuration": { "recipients": [] } }
      ]
    }
  ],
  "source": "lightningReportSubscribe",
  "schedule": {
    "frequency": "weekly",
    "details": { "time": 19, "daysOfWeek": ["sat"] }
  },
  "recordId": "00O4M000004uslcUAA",
  "owner": { "name": "Box Service User", "id": "005610000013EdM" },
  "name": "Notification",
  "lastModifiedDate": "2022-02-06T01:00:23.000Z",
  "id": "0Au4M000000Ch1GSAS",
  "deactivateOnTrigger": false,
  "createdDate": "2022-02-06T01:00:08.000Z",
  "active": true
}

I first poll /services/data/v48.0/analytics/notifications?source=lightningReportSubscribe&ownerId=005610000013EdM and save the first result. 005610000013EdM is another user in my dev instance and not me (JSON above).

Then I delete the subscription as the user (either logging in as them, or sending a DELETE request through the API).

Once the subscription is deleted, I send the JSON back into /services/data/v48.0/analytics/notifications as a POST. This process succeeds, creating a new subscription.

However, I'm now the owner and it counts against my subscription limit! Am I doing something wrong, or is this a feature of the API?

Update: After numerous attempts to change the subscription owner, it appears as though this may be a platform limitation. If I have the opportunity, I'll try and perform a subscription update (rather than a create) and see what the result is. Update will follow.

Update 2: I'm able to update a subscription without issue - however any updates to the owner do not carry over.

// Get the singular subscription tied to report 00O4M000004SA9UUAW
u_AnalyticsAPIUtility.LightningReportSubscription editedSubscription = u_AnalyticsAPIUtility.getAllLightningReportSubscriptions('00O4M000004SA9UUAW')[0];

// Let's try and set the owner as "Box Service User" (currently owned by me)
editedSubscription.owner.id =  '005610000013EdM';
editedSubscription.owner.name = 'Box Service User';

// Let's also edit the subscription time, just to verify the update went through 
editedSubscription.schedule.details.time_x = 17;

// Perform the update (util class returns the updated subscription)
u_AnalyticsAPIUtility.LightningReportSubscription updatedSubscription = u_AnalyticsAPIUtility.updateSubscription(editedSubscription); 

// Passes
System.assert(updatedSubscription.schedule.details.time_x == 17);

// Fails
System.assert(updatedSubscription.owner.name == 'Box Service User');
1
  • Unfortunately, it appears as though this may be a platform limitation. Hopefully with the expansion of the subscription platform, salesforce will include the ability to create subscriptions for other users via the api or ui. As it stands, the documentation surrounding the reports & dashboards api would benefit from mentioning this key limitation.
    – Isaac L
    Commented Feb 6, 2022 at 16:13

0

You must log in to answer this question.

Browse other questions tagged .