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:24 PM
yeah i have added that but its showing null pointer error only
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 11:24 PM
also can you please share the mrvs and table fields screenshot?
Johnny
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2022 11:56 PM
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();
}
Johnny
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2022 01:16 AM
Hi, Were you able to resolve the issue with above code?
Johnny
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2022 02:03 AM
No I am still getting java.lang.NullPointerException on catalog task activity in workflow.