• Scary Cow
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

It looks like in Communities it's not possible for the communities user to decide if they want to auto follow records they create, so I'm trying to use a trigger to accomplish the same goal.

 

The code I've written (stolen) from other places in the forums works great for internal users.... but for community users creating the same type of record, it throws back an error.

 

I'm pretty sure the problem is the: Userinfo.getUserId()  

Anyone get that working in Chatter Communities yet?

 

Here's the code:

 

trigger AutoFollow on Projects__c (after insert) {

Id aid = [Select Id from Projects__c Order By CreatedDate Desc limit 1].id;
EntitySubscription es = new EntitySubscription();
es.ParentId = aid;
es.SubscriberId = Userinfo.getUserId();
insert es;

}

 

Here's the error:

INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, This person’s information is private because they’re not a member of the community.

It looks like in Communities it's not possible for the communities user to decide if they want to auto follow records they create, so I'm trying to use a trigger to accomplish the same goal.

 

The code I've written (stolen) from other places in the forums works great for internal users.... but for community users creating the same type of record, it throws back an error.

 

I'm pretty sure the problem is the: Userinfo.getUserId()  

Anyone get that working in Chatter Communities yet?

 

Here's the code:

 

trigger AutoFollow on Projects__c (after insert) {

Id aid = [Select Id from Projects__c Order By CreatedDate Desc limit 1].id;
EntitySubscription es = new EntitySubscription();
es.ParentId = aid;
es.SubscriberId = Userinfo.getUserId();
insert es;

}

 

Here's the error:

INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, This person’s information is private because they’re not a member of the community.