Override Max Length on single line text variable

Cirrus
Kilo Sage

Afternoon, is anyone able to confirm if this can be done please. When building a catalog item, is it possible to set a maximum length value on a single line text variable unique to that variable?

I cant change the current dictionary value because of the following warning: The field 'Question' on table 'Question' contains existing data records (3593) that exceed the new length

I did find one post that suggested this could be done by an on load client script, but I havent got it to work, tried question.question_text and current.variables.variable_name

 

function onLoad() {
setTimeout(function() {
jQuery('input[name="current.variables.variable_name"').attr("maxlength","10");
}, 1000);

1 ACCEPTED SOLUTION

Hi @Cirrus ,
If you will set the field "Variable attribute" to "max_length=1000", It will allow the user to enter the input into field till max length of 1000 charater.
If the field "Variable attribute" is not present on your form in default view, just bring it out by configure->form layout option.

Please mark my response correct/helpful as applicable!
Thanks and Regards,
Rahul

View solution in original post

8 REPLIES 8

Hello @Cirrus 

Thank you for marking my response as helpful.

if my response helped mark it as correct as well so that it benefits future readers/

Kind Regards,

Ravi Chandra.

Rahul Talreja
Mega Sage
Mega Sage

Hi @Cirrus ,
Have you considered using Service catalog variable attributes.
Hope it solves your query.

Please mark my response correct/helpful as applicable!
Thanks and Regards,
Rahul

Hi @Cirrus ,
If you will set the field "Variable attribute" to "max_length=1000", It will allow the user to enter the input into field till max length of 1000 charater.
If the field "Variable attribute" is not present on your form in default view, just bring it out by configure->form layout option.

Please mark my response correct/helpful as applicable!
Thanks and Regards,
Rahul

Thankyou, exactly what I needed