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 set the number of rows in a multi row variable set using another variable

aditya2810
Tera Contributor

How to set the number of rows in a multi row variable set using another variable as I have one variable named how_many_more_times and option choices are 0,1,2,3,4 and if I choose 1 i need to show one row in mrvs and if i choose 2 then i want to show 2 rows and then respectively till 4th choice.

1 REPLY 1

harish41
Tera Guru

Hi @aditya2810 

It would be better to write a onChange client script on 'how_many_more_times' as below.

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }
    var field = g_form.getField("mrvs"); // multi variable set name
    if (field != null) {
        field.max_rows_size = newValue; // number of rows allowed to be entered
    }
}

 


Thanks,

Harish