4

I have a private chatter group in community. I want to post something in this group by System Admin.

When system admin create a FeedItem and putting ParentId = groupId programatically then getting following Exception :

INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id:

I have also changes the Group Access as public or Unlisted, but error remain the same. Please help me for the same. Follwing is code :

FeedItem feed = new FeedItem();

feed.Body = 'Hello from Admin';

feed.ParentId = '0F9M00000009V7v'; // Community's Chatter Group ID 

feed.visibility = 'AllUsers';

insert feed;
  • 1
    Does the system admin user have explicit access to the Group? – Sebastian Kessel Jan 12 '16 at 8:09
  • Yes. system admin user have explicit access to the Group @Sebastian Kessel – Om Prakash Jan 12 '16 at 9:10
  • Class is sharing included. – Om Prakash Jan 12 '16 at 12:47
  • 1
    Try setting feed.NetworkId to the community's ID also. If the NetworkId isn't set, it defaults to the internal network, which the Chatter group is not a part of. You also don't need to set feed.visibility, because it only applies to posts on records (not groups). – alouie Jan 12 '16 at 22:09
3

I have fixed this issue. I have passed Network scope id.

feed.ParentId = ''; // Community's Chatter Group ID

feed.NetworkScope= ''; // ID of community (network)

| improve this answer | |

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.