The CreatorCon Call for Content is officially open! Get started here.

How to increase Max length of list collector variable

Ramyav
Tera Contributor

Problem: When submitting a service catalog form, the affected CIs selected on the form are not completely visible on the RITM or its child tasks when affected CIs are more than 121. While submitting, it is taking more than 121 records on affected CIs, but only 121 records are showing in the detailed description and request details.

 

Expected Behavior: I must be able to view all of the affected CIs on the RITM and it's child tickets regardless of the number of affected CIs involved. The correct count should be listed in both detailed description and the related list. 

 

Affected CI's
After 121 records this error number '6e0c8b5' is showing up on request details and detailed description. Can anyone help me to fix this issue?

2 REPLIES 2

Ravi Chandra_K
Kilo Patron
Kilo Patron

Hi @Ramyav 

I'm afraid there's a cap on list collector records. Please refer below support articles.

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0954598

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1268773#:~:text=Description,o....

 

Kind Regards,

Ravi Chandra.

Janis Schwering
Tera Contributor

Hi, I have the exact Same Issue. The Issue is caused by the maximum length of the variable. Under the hood the List Collector will save the selected CIs as a comma separeted List of sys_ids. Each sys_id has 32 characters which results in 3872 characters for 121 CIs. Add the 121 commas in that List and you have 3993 characters. As the maximum is set to 4000 characters the first 7 characters of the 122th sys_id are cut off. In your case the 6e0c8b5  are these first 7 characters of the last sys_id. 

 

The best work aound that I found was a Catalog Client Script for onSubmit that prevents if the number of CIs selected is over 121.

 

function onSubmit() {
    var fieldName = 'your_field_name'; //insert your field Name without a variables.
    var fieldValue = [];
    fieldValue = g_form.getValue(fieldName).toString().split(',');

    if (fieldValue.length > 121) {
        g_form.addErrorMessage('Because of technical restaints you can only insert a maximum of 121 CIs. You are trying to insert ' + fieldValue.length + '  CIs.');
        return false; // Prevent form submission
    }

    return true; // Allow form submission

 

 

For me the client Script needed to be set up as UI Type all.

 

I hope this can help.

 

Best Regards,

Janis Schwering