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
Revathy PrasanthRevathy Prasanth 

How to create saleforce report who/how many people are subscribed to files on the library

Hello,

 

I believe there should be a relationship between the objects to generate a combined report on them. There is no built in relationship between User and Document objects in Salesforce.

So we have to create a Look-up/Master-detail/Many-to-many relationship in either of the objects to the other. But there is no option to create a relationship with the Document object.

 

Is it possible to create look-up /Master-detail relationship with Document object on User object or on a Custom object?

Could anybody please share your idea on this issue?

 

Thanks in advance,

Revathy

BharathimohanBharathimohan

Hi Revathy,

 

Whether you want to know which users are subscribed to Files or Documents or Content Libraries?

Please help explaning your question in detail.

 

If you want to know which users are following a particular file, you can use the below code

 

List<EntitySubscription> es =[Select Id,SubscriberId,Subscriber.Name from EntitySubscription where ParentId='069U0000000A1UI']; // ParentId is the File name
Integer i=0;
for(EntitySubscription e:es)
{
    system.debug('Follower '+i++ +e.Subscriber.Name);    //prints the Users name who is following the particular file
}

We cannot create relationship between Document and with User Object, which is a strange requirement which you are expecting for as every object can have Notes and Attachments.

 

Please revert in case of any further clarifications.

 

Mark this post as solved, if it helped you.

 

Regards,

Bharathi
Salesforce For All

 

 

Revathy PrasanthRevathy Prasanth

Thank you Bharathi for your reply.

I need to get a report on which users are subscribed to the Files in the organisation.

I tried the query on the EntitySubscription object. It is giving the error "INVALID_TYPE - SObject type 'EntitySubscription' is not supported". Should I enable chatter to solve this?

BharathimohanBharathimohan

Hi Revathy,

 

We dont have a report option to know which users are subscribed to the Files in the organisation.

We need to go for some apex coding options.

Whenever a user clicks "Follow" button, a new EntitySubscription record will be created with SubscriberId as UserId and ParentId as recordId (which may be File in this case).

 

I tried querying it in both data loader and force.com explorer, works fine.

 

Please let me know where you tried to query this object, and got this error.

 

 

Regards,

Bharathi
Salesforce For All