I have a 2 level approval process. At the end of 2nd final level approval - the status field on the object is set to APPROVED. I have a trigger on after update, after insert, etc... on custom object that creates an Event in user calendar when status=approved.
Expected behaviour: The event should be created by the user who is the owner of my custom record.
What is happening: The event get created but the created by = last approver instead of record owner. It assigns the event to current user properly. I have already tried
system.runAs(user) but its not work for me. Is there any other workaround?