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

Murthy Ch
Giga Sage

Hi Sneha,

You need to create records based on the MRVS rows?

If yes you need to get the row one by one and insert the records into custom table based on the number of rows in MRVS.

Let me know if you need more help so that I will share sample code.

Thanks,

Murthy

Thanks,
Murthy

Can you try this:

var rowsInt = current.variables.server_request;
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();
}

Hope it helps

Thanks,
Murthy

getting below error.

find_real_file.png

I'm sorry

Small mistake

var rowInt = current.variables.server_request;
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,
Murthy