You need to sign in to do that
Don't have an account?
hkp716
Trigger give me an error
Hi Everyone,
I want to uncheck a checkbox after I save a record. I have a vadation rule stating the checkbox should be checked if status is "new". Even if the status is "new" i want the trigger to uncheck the box after save so if someone edits the record they have to recheck the box, if the status is still new.
My Trigger:
trigger Uncheckbox on Lead (after update) {
for (Lead cb : Trigger.new) {
if (cb.Confirm_New_Status__c == true) {
Lead ourcb = new Lead (Confirm_New_Status__c=false);
update ourcb;
}
}
}
Any suggestions?
-Hkp716
Hi John,
I tried using both but neither of them would work. I decided to use workflows instead. Thank for the input though.
-hkp716
All Answers
This should be a before trigger:
Hope this helps,
Hi John,
I tried using both but neither of them would work. I decided to use workflows instead. Thank for the input though.
-hkp716
trigger Uncheckbox on Lead (before update) {
for (Lead cb : Trigger.new) {
if (cb.Confirm_New_Status__c == true)
{
cb.Confirm_New_Status__c=false;
}
}
}