How to validate input for a system property

Josh5
Tera Contributor

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.

1 REPLY 1

The SN Nerd
Giga Sage
Giga Sage

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