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

Trigger question . Pls help on this

Hi . 
I need to update the owner field in a custom object  when a custom field(which has look up to user) changes . I need to check when inserting and updating if the field has value and it is changed , then i need to update owner filed with the value. 

Object : Registration 
custome field : Adviser - look up to user 

need to chnage the owner field in the Registration obj with adviser field.

1)Having a  problem if that before update or after update trigger. 
If  I write after update trigger . I am  wondering if the trigger will run again and again. It will be a recursion. Pls help on this 
Raj VakatiRaj Vakati
You need to write the trigger on after update .. before the update will work for you 
Trigger TriggerName on Registration__c(before insert, before update) {
  for(Registration  reg : Trigger.New){
	 reg.OwnerId = reg.Adviser ;