• pranav dinakaran 11
  • NEWBIE
  • 0 Points
  • Member since 2016

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

Hi All ,
I have an issue . Let me explain the problem.
I am sharing A custom object Record through before trigger . And the Object is OWD Private.

I am changing record owner as System Administrator who ever insert the record .
User u = [select Id from User where Profile.Name='System Administrator' Limit 1];
for(Project__c p : trigger.new){
p.ownerId = U.Id;
}
Now let say any of the user insert the Project__c records trigger will change the owner.
Once owner is change as System Admin. This user can not share this recod with other users because OWD is private.

The User who insert this record do not have privelage to share the record.

Now suggest me how to share these records in sigle trigger script.