Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

how to give max length for multi line text in service portal?

Aviram
Tera Contributor

Hi,

I need to set limitation for variable type: multi line text and set the max character to 4,000.

5 REPLIES 5

Nitesh Asthana1
Kilo Guru

catalog item multiline text field? Or HTML text field?


catalog item multiline text field


Try below catalog client script,



find_real_file.png



function onChange(control, oldValue, newValue, isLoading) {


    if (isLoading || newValue == '') {


          return;


    }


    var multi = g_form.getValue('multi');


    var len = multi.length;


  if(len>4000){


  var str = multi.slice(0,4000);


  g_form.setValue('multi',str);


  alert('Length exceeded');


  }


}


I didn't explain myself properly,


I don't want to allow enter more then 4,000 characters, so when the user enter the 4,000 character he can't type anymore.
Just like the Variable attributes max_lenght in Single Line Text.