• Julio Henriquez
  • 0 Points
  • Member since 2012

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 0



I'm trying to create a couple share records for a custom object we have. To be more especific, I'm using a trigger (after insert) to take CustomObject being created, execute some logic to get a list of User objects and give access to those users using CustomObject__Share.


For instance:


User[] users /* = Execute logic to get a list of users. */


for(User user : users) {
                insert new CustomObject__Share(ParentId = Trigger.new[0].Id,
                                                    UserOrGroupId = user.Id,
                                                    AccessLevel = 'Read'


But everything runs smoothly until it yeilds "insufficient access rights on cross-reference id" when I'm about to insert my new CustomObject__Share instance. I've been searching for information regarding this exception, but every effor until now has been fruitless, this error is not very much self-describing.


Could somebody help me by explaining the meaning of this exception in this context?

Where should I looks about where to solve this issue?