Scenario Overview
In this scenario we need to validate that the SSN field on the Contact entity is in the correct format. If it is not in a valid format then we need to display a message to the user and stop the save from occurring. The validation rule needs to fire when the user changes data with the SSN field. (i.e. the onChange() event)
North52 Decision Suite Solution
The North52 Decision Suite solution works like this,
- We create a formula that executes on the client-side when ever the SSN field on the Contact entity changes.
- We use a Regular Expression to perform the format validation
- If the validation match returns false an error message will be displayed to the user
- Otherwise it will pass
North52 Decision Suite Steps
- Create a new formula of type 'Validation'
- Set the Source Entity to 'Contact'
- Set the Mode to 'Client-Side'
- Set the Source Property to 'SSN' on the desired forms & also select 'OnSave'. (Use Ctrl key to multi-select)
- Copy & paste the formula below into the formula description field, change the field reference to your SSN field
- Click save
- On the Command Bar click 'N52 Commands - Publish Formula'
- You are ready to test
Formula
if( RegexIsMatch([contact.new_ssn] , «^\d{3}-\d{2}-\d{4}$») , 'NoOp' ,
'You have entered in an invalid SSN. Please resolve this issue.')