You need to sign in to do that
Don't have an account?
Manuel Dangond
Trigger to check if encripted field changed
Hello,
I've never written a trigger before and was wondering if someone can help. All I need is a trigger on the Account object, on update, that will check to see if Tax ID changed. If this is true, then update the Comments field with something like "Tax ID was last updated on" & Today(). The pseudocode would be something like this:
Trigger TaxIdChanged on Account (On Update)
If ISCHANGED(Tax_id__c) = True
Comments = "Tax ID was last updated on" & Today()
End
It is important to know that Tax_Id__c is an encrypted field and this is why I'm having to try to create a trigger to do this since I believe is the only way to look at the contents of an ecrypted field. I've tried doing this via a workflow rule or process builder, and unfortunately was not able to do it becuase I'm dealing with an encrupted field.
Thank you so much!!
I've never written a trigger before and was wondering if someone can help. All I need is a trigger on the Account object, on update, that will check to see if Tax ID changed. If this is true, then update the Comments field with something like "Tax ID was last updated on" & Today(). The pseudocode would be something like this:
Trigger TaxIdChanged on Account (On Update)
If ISCHANGED(Tax_id__c) = True
Comments = "Tax ID was last updated on" & Today()
End
It is important to know that Tax_Id__c is an encrypted field and this is why I'm having to try to create a trigger to do this since I believe is the only way to look at the contents of an ecrypted field. I've tried doing this via a workflow rule or process builder, and unfortunately was not able to do it becuase I'm dealing with an encrupted field.
Thank you so much!!
You can achieve this by using multiple ways:
1) Workflow / Process Builder
2) Apex trigger
3) By using Standard Enable Account History feature
Lets do it using Workflow Field Update:
Create Workflow on Your Account Object similar to Below Image. I am using Sum_Of_Salary__c(You can use your Field ) field which available in my system :
Also add Workflow Field Update as below:
Please let me know if helped. Mark as best answer for others help.
Regards,
Ramakant
Ischanged() is not work on the apex classes or triggers. Better you can used trigger.oldmap and trigger.new to check.
Mark as best answer if it helps you.