function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
BhavanaSinghBhavanaSingh 

Triggers seems to be running in user context

I have a trigger on Task where it is supposed to get the parent record (a custom object) and find the opportunity owner name (a formular field). Then find the User with that name and assign the task to that user. I am running into Insufficient Privileges error when the task is created logged in as a non system admin user. Of course, it works fine when I log in as system admin and run it.

I am confused about this behavior as the trigger should be running in the system context?

 
Karan Shekhar KaulKaran Shekhar Kaul
Does that non sys admin user has access to parent record .OWD of task is controllled by parent.So depending on access to whoid or what id , a user will get access to task record.
Also check FSL of all fields used in the code.
BhavanaSinghBhavanaSingh
Yes, I had checked that first. I was able to get this to work if I allow view all users in the permission set. I guess the user couldnt see a user, so the task couldnt be assigned. But I thought since trigger runs in system context, it will allow that task assignment.