We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

I have a requirement in a Record Producer where I need to restrict a variable input to a maximum of

jeevanjadhav
Tera Contributor

Hi All,

I have a requirement in a Record Producer where I need to restrict a variable input to a maximum of 100 characters at the time of submission.

The user should not be able to submit the record if the entered value exceeds 100 characters. I would like to implement this validation on the Record Producer variable during submit.

Could you please suggest the best way to achieve this? Should this be done using a Catalog Client Script (onSubmit), UI Policy, or any out-of-the-box configuration?

Thanks in advance.

7 REPLIES 7

Shruti
Giga Sage

Hi

You can update variables attributes max_length=100

Shruti_0-1770876415465.png

 

Hi @jeevanjadhav 

Follow her and your work done.

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

Thanks, this helped me. I was able to resolve the issue using your suggestion. Appreciate the support!

Mohit 101
Tera Contributor

hi @jeevanjadhav ,

use an Out-of-the-Box (OOTB) Variable Attribute

 

function onSubmit() {
var val = g_form.getValue('your_variable_name');
if (val.length > 100) {
g_form.addErrorMessage('exceed 100 characters.');
return false; }
}

 

Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for.

Thank You