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

Ok 

Give this a final try:

Remove the function and update as it is:

var rowInt = current.variables.server_request; //hope you have given MRVS internal name
gs.info("MRVS DATA"+rowInt);//check whether we are getting MRVS data or not
var mrvsCount=rowInt.getRowCount();
for (var i = 0; i < mrvsCount; i++) {
var row = rowInt.getRow(i); //gettting the row one by one
var grTask = new GlideRecord('u_customtbl');
grTask.initialize();
grTask.u_usercerts = row.user_certs; //map all the variables like this
grTask.insert();
}

Thanks

Thanks,
Murthy

not working

Yes murthy I have to create records based on MRVS. Please share the sample code.

 

Aiswarya Brigh1
Tera Contributor

Hi Sneha,

 

Can you please try the below code

(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.server_request[i].user_certs;

            grTask.insert();

        }

 

})();

getting null pointer exception error on workflow activity.