Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

レコードプロデューサーのリストコレクターの制御について

TianhanJ
Mega Guru

レコードプロデューサーのリストコレクター変数について、

デフォルトで最大何個まで選択できますでしょうか?

また、選択できる個数を制御することができますか?

2 ACCEPTED SOLUTIONS

Ankur Bawiskar
Tera Patron
Tera Patron

@TianhanJ 

you cannot enforce minimum value in list collector without scripting.

So if you want user to select max 5 values then you will have to use onChange catalog client script and throw error to user if they cross that limit.

Something like this

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || !newValue) {
        return;
    }

    var selectedValues = g_form.getValue('<list_collector_name>').toString().split(',');

    if (selectedValues.length > 10) {
        alert('You can select a maximum of 10 values.');
    }
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

@TianhanJ 

usually it's recommended to keep it under 20 but no documentation says it

You can read more about it here:

Limiting Number of Selections in a List Collector

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@TianhanJ 

you cannot enforce minimum value in list collector without scripting.

So if you want user to select max 5 values then you will have to use onChange catalog client script and throw error to user if they cross that limit.

Something like this

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || !newValue) {
        return;
    }

    var selectedValues = g_form.getValue('<list_collector_name>').toString().split(',');

    if (selectedValues.length > 10) {
        alert('You can select a maximum of 10 values.');
    }
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Thanks for your response.

I'm done with it.

 

And what is the default maximum number of the list collector?

@TianhanJ 

usually it's recommended to keep it under 20 but no documentation says it

You can read more about it here:

Limiting Number of Selections in a List Collector

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader