You need to sign in to do that
Don't have an account?
apex trigger update custom field when checkbox ticked
Not used Apex triggers before but I would like to use one to update a custom field with the user's name who checked the checkbox.
Object - Account (new and existing)
Checkbox - Verified
Custom Field - Verified_By
Any assistance would be greatly appreciated.
Thanks in advance
Object - Account (new and existing)
Checkbox - Verified
Custom Field - Verified_By
Any assistance would be greatly appreciated.
Thanks in advance
All Answers
This is where I have got to with my code. However, it doesn't like to call the user object. How do I get it to update the custom field with the user who checked the checkbox?
trigger UpdateVerifiedBy on Account (before update) {
for (account a : trigger.new){
if (a.verified_account__c == true) {
a.Verified_by__c = $user.FirstName $user.LastName;
}
}
}
This worked a treat :-)