Search code examples
triggerssalesforceapex-code

Security context in a trigger


I'll start of by saying that I'm a .net guy having to play in a salesforce.com world right now.

My question is this;

Within the context of an pre-update/insert trigger can I set the value of a field that the user (the user that is updating the object when the trigger fires) does NOT have on their page layout?


Solution

  • Yes.

    However, the user might still be restricted from modifying that field due to restrictions on the field itself. If it's a standard object, you can go to Setup > App Setup > Customize. Then choose the object in question and go to the "Fields" link. There you can see each field on the object and view the field-level security.