I am working on a scenario wherein when a user lookup field is filled an Object_Share record is created so that the lookup user can access the record.
So in the trigger I have a function where a Object_share record is created for each record.
For trigger.update it is understandable that sharedRecord.parentId = lookupuser.id. I am wondering how to fill parentId in case of trigger.insert ,as id would not have been created .
What is the workaround for creating shared record in insert?