How to validate input for a system property
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2015 02:30 PM
I have a custom application that is using a system property to store a decimal percent value (as a string) that is used throughout the application. This value will be changed by an application admin of sorts. I need a way to validate that the user enters an appropriate value. I have searched around and cannot find much of any documentation regarding custom properties. Can this be done or should i look into using something else? Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2015 05:50 PM
You could create a before business rule on the 'sys_properties' table to validate particular data types.
For example
Condition:
Type IS string AND Name contains "sys_id"
Script
if ( current.getValue(value).length != 32 ) {
current.setAbortAction(true);
gs.addErrorMessage('You must enter a valid sys id');
}
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022