3

Is there a way to access, query, or update the following User preferences via the API or SOQL?

  • The Dashboard assigned to the User's homepage

I've looked for any reference to these in the Force.com IDE's Schema Browser, and also checked the API reference, but can't find any mention of them.

Thanks!

NOTE: I've split this out of another question since the two parts require different answers.

1 Answer 1

3

I took a recent Data Export from a large Org and extracted all the CSV files into a directory.

The key prefix for Dashboards is 01Z, so I searched all the csv files for the string:

"01Z

There were hits in EntitySubscription.csv, FeedPost.csv, and NewsFeed.csv.

The EntitySubscription table (0E8 key prefix) might be where Salesforce stores this information. The CSV has the following columns:

  • Id
  • ParentId - ID of the record or user which the user is following.
  • SubscriberId - ID of the User who is following the record or user.
  • CreatedById, CreatedDate, IsDeleted

The matching rows had the Dashboard id in the ParentId column and User Ids in the subscriber column.

As to how you would access or manipulate this data via the API or SOQL, I don't think you can as I can't see EntitySubscription via the API.

Update

Odd, on the first Org I tried EntitySubscription didn't show via the API. It was available in another one.

Here is a SOQL query to find EntitySubscription records connected to Dashboards:

Select 
     Id,ParentId,SubscriberId,IsDeleted
From EntitySubscription 
Where 
     ParentId in (Select Id from Dashboard)
Limit 100
5
  • 1
    You can definitely access EntitySubscription. It is used to indicate that a user is following something in Chatter as well. I've used it before to programmatically set a user to follow a record. The chatter recipes: wiki.developerforce.com/page/Chatter_Code_Recipes AND the API documentation: salesforce.com/us/developer/docs/api/Content/…. If you query EntitySubscription make sure to use the LIMIT clause and have it be 1000 or less. If you don't you'll get a runtime error when anyone other than a Sys Admin executes the code. Aug 31, 2012 at 1:18
  • @PeterKnolle Yes, I just realised I was wrong there. I'm just updating the answer with a SOQL example now. Aug 31, 2012 at 1:20
  • EntitySubscription isn't available via DemandTools or the Data Loader. Do you know of a tool I could use to manipulate (aside from writing Apex...)
    – Benj
    Sep 4, 2012 at 17:10
  • Nor via SOQL... maybe because we don't have Chatter enabled yet. Oh, well.
    – Benj
    Sep 4, 2012 at 20:38
  • @Benj EntitySubscription doesn't appear to be available universally via the Partner API. There must be some Org or user session setting that enables it. That, or the version of the Partner API being used. Sep 5, 2012 at 8:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .