Inserting empty in custom table(Multi row variable set)

Sneha39
Mega Guru

Created MRVS on catalog item and inserting these variable values into the custom table but its adding empty value in the custom table.

 

using below script in task activity of workflow ( As i want task to be created and in the same time variables values to be submitted in custom table as well)

(function() {

        var rowsInt = current.variables.server_request.getRowCount();

        for (var i = 0; i < rowsInt; i++) {

           var grTask = new GlideRecord('u_customtbl);

            grTask.initialize();

            grTask.u_usercerts = current.variables.user_certs;

            grTask.insert();

        }

 

})();

find_real_file.png

 

 

26 REPLIES 26

yeah i have added that but its showing null pointer error only

also can you please share the mrvs and table fields screenshot? 

Thanks
Johnny

Please mark this response as correct or helpful if it assisted you with your question.

Hi,

 

This seemed to work fine in my PDI, make sure to change the variable names and try

(function() {

var rowsInt = current.variables.urmrvs_name.getRowCount();
for (var i = 0; i < rowsInt; i++) {
var grTask = new GlideRecord('ur_custom table');
grTask.initialize();
grTask.table_fieldname1 = current.variables.urmrvs_name.mrvs_fieldname1;
grTask.table_fieldname2 = current.variables.urmrvs_name.mrvs_fieldname2;

var res = grTask.insert();

}

 

Thanks
Johnny

Please mark this response as correct or helpful if it assisted you with your question.

Hi, Were you able to resolve the issue with above code?

Thanks
Johnny

Please mark this response as correct or helpful if it assisted you with your question.

No I am still getting java.lang.NullPointerException on catalog task activity in workflow.