Solved

Validation to ensure a free-text field entry is always unique?

  • 19 August 2021
  • 3 replies
  • 5 views

I have a simple SmartForm whereby a user can input a 'Reference', just a string of text which helps to identify a record. I want to ensure that whatever the user inputs here is always unique, but I'm not sure how is best to do this?

 

I noticed you can tick 'Unique' against a field in the SmartObject, but unfortunately it's asking me to wipe the SmartObject's data in order to change this. Is this how it can be achieved, or is that different?

 

Thanks

icon

Best answer by tbyrne777 19 August 2021, 17:15

View original

3 replies

Userlevel 5
Badge +13
I don't think there is a great automated way to do this. My approach would be that when the text changes, run a smart object to get a record by the Id that they entered and if something actually comes back, then the value is invalid
Like tbyrne777 said, i would do the same, you can even test by having a listview and use a for loop to check if the reference already exists, if so then throw an error message and stop the rule execution

Thanks for the suggestion. In the end I did truncate the table and set the SmartObject field to unique, which in turn created automatic validation when the user attempts to input a duplicate string. However if I come across the same scenario again I will give your method a try!

Reply