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 11:48 PM
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
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2022 01:03 AM
not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 10:31 PM
Yes murthy I have to create records based on MRVS. Please share the sample code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 10:41 PM
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();
}
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 10:57 PM
getting null pointer exception error on workflow activity.