Multi Row Variable Set Exceeds System Limit

Mathieu8
Kilo Guru

Hi Community!

I have a form in our Service Portal that has a Multi-Row Variable set. This particular set is a list of users that gets pre-populated and then users can be added or removed.

We've just hit an issue where the "Add" button gets disabled and when we try and submit the form it gets this error:

{"error":{"detail":"","message":"The maximum rows specified in the multi-row variable set users attribute exceeds the system limit."},"status":"failure"}

There are about 50 users listed. I specifically was using multi-row variable sets to avoid the low limitations of the other list types in forms. I know I could switch the variable type to a Macro and build my own widget. Does anyone know how I can get around this limit without replacing the multi-row variable set? 

 

Thanks!

 

 

1 ACCEPTED SOLUTION

Oleg
Mega Sage

I find the question interesting and so I tried to analyse the problem. Setting of max_rows attribute (described in the documentation see here and here), suggested by audrey.deruere, is a good idea, but it not worked. By trying to set max_row to any value to 50 and higher one gets error message. Event if one uses Export/Import to XML to force setting the value to a higher value one still get the same error message "The maximum rows specified in the multi-row variable set {0} attribute exceeds the system limit".

The reason on the message in the code of REST API used by "Add to Card" and "Order Now". The server side code is not readable directly, but with some tricks one can find it. It contains the following code fragment:

var mrvsErrorMessages = catUtil.validateMaxRowCountMultiRowVS('sc_cat_item', itemId, itemId, request_body.variables);
if (mrvsErrorMessages && mrvsErrorMessages.length > 0) {
    var errors = mrvsErrorMessages.join();
    throw new sn_ws_err.BadRequestError(errors);
}

where catUtil variable is 

var catUtil = new RestCatalogUtil();

The code of RestCatalogUtil can be read, but can't be modified. The code of validateMaxRowCountMultiRowVS method calls GlobalServiceCatalogUtil.getMaxRowCountMultiRowVS to get the limit of the rows of 

var globalCatalogUtil = new global.GlobalServiceCatalogUtil();
var varKeys = Object.keys(variablesData);
for (var i = 0; i< varKeys.length; i++) {
	var varName = varKeys[i];
	var varValue = variablesData[varName];
	if (mrVarSetIdtoNameMap[varName] && varValue != '') {
		
		var rowArray = JSON.parse(varValue);
		var rowCount = rowArray.length;
		var rowLimit = globalCatalogUtil.getMaxRowCountMultiRowVS(mrVarSetIdtoNameMap[varName],srcTable, srcId);
		if (rowCount > rowLimit) {
			valMessages.push('The maximum rows specified in the multi-row variable set ' + varName +' attribute exceeds the system limit.');
		}
	}
}

(By the way, the code is dirty at least because the message will be not localized).

Finally, the code of getMaxRowCountMultiRowVS method of GlobalServiceCatalogUtil is read-only too and it forwards the call to getMaxRowCountMultiRowVS method of undocumented GlideappScriptHelper.

getMaxRowCountMultiRowVS: function(variableSetId, srcTable, srcId) {
    return GlideappScriptHelper.getMaxRowCountMultiRowVS(variableSetId, srcTable, srcId);
}

In other words, I don't find a way to fix the problem using Multi-Row Variable set.

As the workaround I can suggest you to use variable of the List Collector type with sys_user as the List table. It has no such limit. I personally find the User Interface of the List Collector even more comfortable, because it not displays previously added users and the User list will be displayed in more compact way:

find_real_file.png

View solution in original post

8 REPLIES 8

Audrey Deruere
Mega Expert

Hi Mathieu,

 

In the documentation of ServiceNow you have this information : 

  • Set a limit to the number of rows that you can add to a multi-row variable set by using the max_rows attribute in the Variable Set attributes field.

You can try to set the attribute to 100

Related to the message that you copy in the description of your question I'm affraid that is the limit of ServiceNow and even if you set the attribute to 100 the limit is maybe always 50 or below.

 

Regards,

Audrey

I tried to enter the max limit by adding max_rows 2 in Variable set attribute ,but it gives error  while rendering it on the portal

 

 

find_real_file.pngfind_real_file.png

Oleg
Mega Sage

I find the question interesting and so I tried to analyse the problem. Setting of max_rows attribute (described in the documentation see here and here), suggested by audrey.deruere, is a good idea, but it not worked. By trying to set max_row to any value to 50 and higher one gets error message. Event if one uses Export/Import to XML to force setting the value to a higher value one still get the same error message "The maximum rows specified in the multi-row variable set {0} attribute exceeds the system limit".

The reason on the message in the code of REST API used by "Add to Card" and "Order Now". The server side code is not readable directly, but with some tricks one can find it. It contains the following code fragment:

var mrvsErrorMessages = catUtil.validateMaxRowCountMultiRowVS('sc_cat_item', itemId, itemId, request_body.variables);
if (mrvsErrorMessages && mrvsErrorMessages.length > 0) {
    var errors = mrvsErrorMessages.join();
    throw new sn_ws_err.BadRequestError(errors);
}

where catUtil variable is 

var catUtil = new RestCatalogUtil();

The code of RestCatalogUtil can be read, but can't be modified. The code of validateMaxRowCountMultiRowVS method calls GlobalServiceCatalogUtil.getMaxRowCountMultiRowVS to get the limit of the rows of 

var globalCatalogUtil = new global.GlobalServiceCatalogUtil();
var varKeys = Object.keys(variablesData);
for (var i = 0; i< varKeys.length; i++) {
	var varName = varKeys[i];
	var varValue = variablesData[varName];
	if (mrVarSetIdtoNameMap[varName] && varValue != '') {
		
		var rowArray = JSON.parse(varValue);
		var rowCount = rowArray.length;
		var rowLimit = globalCatalogUtil.getMaxRowCountMultiRowVS(mrVarSetIdtoNameMap[varName],srcTable, srcId);
		if (rowCount > rowLimit) {
			valMessages.push('The maximum rows specified in the multi-row variable set ' + varName +' attribute exceeds the system limit.');
		}
	}
}

(By the way, the code is dirty at least because the message will be not localized).

Finally, the code of getMaxRowCountMultiRowVS method of GlobalServiceCatalogUtil is read-only too and it forwards the call to getMaxRowCountMultiRowVS method of undocumented GlideappScriptHelper.

getMaxRowCountMultiRowVS: function(variableSetId, srcTable, srcId) {
    return GlideappScriptHelper.getMaxRowCountMultiRowVS(variableSetId, srcTable, srcId);
}

In other words, I don't find a way to fix the problem using Multi-Row Variable set.

As the workaround I can suggest you to use variable of the List Collector type with sys_user as the List table. It has no such limit. I personally find the User Interface of the List Collector even more comfortable, because it not displays previously added users and the User list will be displayed in more compact way:

find_real_file.png

Thank you for all the help from yourself and Audrey.

 

The List Collector UX unfortunately will not work for us. I will likely build a macro that updates a hidden list or text box. Thanks again! Extremely informative.