cancel
Showing results for 
Search instead for 
Did you mean: 

Leading & Trailing Spaces - Custom Fields - Advanced Workflow

AnjaniAL
Explorer
0 Kudos
88

To ensure that no leading or trailing spaces are entered by a user in custom fields, what is the best approach? A regular expression prevented spaces between numbers but did not prohibit leading or trailing spaces.

Accepted Solutions (0)

Answers (1)

Answers (1)

Eli-Mayfield
Newcomer

I would recommend using a script that executes after changing the value of a custom field. In that script, you could get the last updated field and trim its value, then set the trimmed value back into the last updated field.

In Advanced Workflow's groovy:

def updatedField = form.getLastUpdatedField()
updatedField.setValue(updatedField.getValue().trim())