You need to sign in to do that
Don't have an account?
Melissa Parker 17
Update lookup field with login user
Hi All,
Is it possible to update a lookup field to the User object of the person who is creating that record? We have a custom object with a Lookup field (to user) called "Sales Rep". We would like to 'default' this field to the person who is creating that record at that time (current logged in user).
The owner field will be changed to someone else in the meantime. Thanks for the help!
Is it possible to update a lookup field to the User object of the person who is creating that record? We have a custom object with a Lookup field (to user) called "Sales Rep". We would like to 'default' this field to the person who is creating that record at that time (current logged in user).
The owner field will be changed to someone else in the meantime. Thanks for the help!
trigger NameOfTrigger on ChildObject__c (before insert){
for(ChildObject__c obj : trigger.new){
obj.User = userInfo.getUserId();
}
}
Choose field update as the action, and update the field using a formula. The contents of the formula should be $User.Id
This will populate the user lookup field with the logged in user.