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
DarbDarb 

Trigger to change the user

I have a custom objects that receives records from an external system.  When the records come in I want to assign them to a specific user to maintain security.  I believe a trigger would work best but have no experience creating one.  Can anyone help?
Best Answer chosen by Admin (Salesforce Developers) 
AlexPHPAlexPHP

You should read the Triggers section in the APEX Language Reference

 

http://www.salesforce.com/us/developer/docs/apexcode/salesforce_apex_language_reference.pdf

 

Triggers work fairly straight-forwardly.  You can specify them to run on different types of operations.

 

In your case, you'd probably be using a "before insert" trigger to set the owner of the record before it is inserted into the system. 

 

Further, you might want to look into Workflow Rules.  It may save you from having to code.

Message Edited by AlexPHP on 03-02-2010 01:52 PM

All Answers

AlexPHPAlexPHP

You should read the Triggers section in the APEX Language Reference

 

http://www.salesforce.com/us/developer/docs/apexcode/salesforce_apex_language_reference.pdf

 

Triggers work fairly straight-forwardly.  You can specify them to run on different types of operations.

 

In your case, you'd probably be using a "before insert" trigger to set the owner of the record before it is inserted into the system. 

 

Further, you might want to look into Workflow Rules.  It may save you from having to code.

Message Edited by AlexPHP on 03-02-2010 01:52 PM
This was selected as the best answer
Brad007Brad007

I have a trigger (after update) which sends an email, I have to change the running user in apex code before sending the email. Could anybody guide me through the process ?