Inserting empty in custom table(Multi row variable set)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 10:00 PM
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();
}
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 10:20 PM
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
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 10:24 PM
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
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 10:53 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 10:55 PM
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();
}
Murthy