You need to sign in to do that
Don't have an account?
Visithra
Help me with the trigger
Need to block the user for updating the address field more that 5 times, store the number of times allowed in a cutom label and use in trigger, if require create a custom fields to track number of changes so far completed.
Try below approach
Step 1:
Create a Custom Label:
Go to Setup -> Custom Labels -> New Custom Label.
Provide a Label Name, such as "Max_Address_Changes".
Set the value to 5 (the maximum allowed number of address changes).
Step 2:
Create a Custom Field to Track Changes:
Create a custom Number field on the contact object to store the count of address changes.
Name the field something like "Address_Change_Count__c".
Set the initial value of the field to 0. (Else trigger will give null pointer exception)
In the trigger, increment this field whenever the address is updated.
Step 3:
Trigger:
Upon implementation, it would throw error upon crossing 5 updates to MailingStreet
If this information helps, please mark the answer as best. Thank you