You need to sign in to do that
Don't have an account?
ChickenOrBeef
Have trigger edit as certain user, instead of running user
Hey everyone,
Maybe there's a better way to go about this, but here's an example issue:
We have an opportunity lookup field on accounts. If someone populates that lookup field, then that selected opportunity should be updated via a trigger I have set up. The issue is that some of those opportunities may not be owned by the running user.
So the issue? We don't want our users able to edit opportunities they don't own, but we want to make an exception for this trigger, and for all triggers really. So is there a way to have a trigger always make edits as a certain user, such as myself? If we do that, we can keep their permissions as Read Only, while having the triggers edit opps as if an admin is doing it.
If there's a smarter way to go about this, please let me know.
Thanks!
-Greg
Maybe there's a better way to go about this, but here's an example issue:
We have an opportunity lookup field on accounts. If someone populates that lookup field, then that selected opportunity should be updated via a trigger I have set up. The issue is that some of those opportunities may not be owned by the running user.
So the issue? We don't want our users able to edit opportunities they don't own, but we want to make an exception for this trigger, and for all triggers really. So is there a way to have a trigger always make edits as a certain user, such as myself? If we do that, we can keep their permissions as Read Only, while having the triggers edit opps as if an admin is doing it.
If there's a smarter way to go about this, please let me know.
Thanks!
-Greg
We do not have a doAs in Java to execute in Trigger.
I was able to find the below artcle that should help you.
http://www.tgerm.com/2011/03/trigger-insufficient-access-cross.html
Let me know if this helps!
Thanks,
Aakaash
So if I need a trigger to update a record that the running user doesn't have permission to edit, is there any way to accomodate that? Do I just need to remove the sharing restrictions?
I would think that you would need to remove the sharing restriction.
Dont seem to get any solution at the moment.
Will try and check if its possible.
Thanks,
Aakaash