You need to sign in to do that
Don't have an account?
Akis Athanasiadis
Update Custom Field in Users Object
Hi,
I am trying to create a trigger which will be checking a checkbox automatically when another process is done.
In specific, I have a custom object Vacation Requests which follows an approval process. If the request is approved, a checkbox "Approved" is being checked.
Then I am creating a trigger which needs to check if the current date is = to the start date of the vacation. if yes, then the checkbox should be selected.
However this doesn't happen.
Any ideas?
I am trying to create a trigger which will be checking a checkbox automatically when another process is done.
In specific, I have a custom object Vacation Requests which follows an approval process. If the request is approved, a checkbox "Approved" is being checked.
Then I am creating a trigger which needs to check if the current date is = to the start date of the vacation. if yes, then the checkbox should be selected.
However this doesn't happen.
Any ideas?
trigger Vacation on Vacation_Requests__c (before insert) { User u = new User(); for (Vacation_Requests__c vr:Trigger.new) { if (vr.Approved__c==true && vr.Start_Date__c==System.Today()) u.On_Vacation__c=true; } }
I am also thinking that it should be After Update since when user submits Vacation record, its After insert and someone has to approve the record which is AFTER UPDATE. Isn't it?! Let me know your thoughts..
Your Trigger Code can be something along these lines:
If this helps or solves the question then please mark it as Best Answer!
All Answers
i used =>
In that case the trigger is trigged while on approving the request. So it seems the issue comes when trying to update a field in another object.
Ideas?!?!?!?
Any ideas on how to connect them?
I am also thinking that it should be After Update since when user submits Vacation record, its After insert and someone has to approve the record which is AFTER UPDATE. Isn't it?! Let me know your thoughts..
Your Trigger Code can be something along these lines:
If this helps or solves the question then please mark it as Best Answer!
this worked!!!!!
What about if I want the checkbox to be automatically unchecked past the vacation end date?
I have used this=>
but it didn't trigger