
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-05-2022 01:49 PM
I'm trying to set some MRVS variables with a Flow Designer Action. Here is my script. Rows do not get added. What am I missing?
Input is the trigger RITM.
(function execute(inputs, outputs) {
var ritm = inputs.request_item;
var mrvs = ritm.variables.please_provide_the_property_number_s_and_associated_information;
var parser = JSON.parse(mrvs);
for (var i = 0;i < parser.length;i ++) {
var maxInt = 0;
var interfaces = parser[i].how_many_network_interfaces_are_required;
if (interfaces != '')
maxInt = parseInt(interfaces);
if (maxInt > 0) {
var propNum = parser[i].property_number;
var f = new GlideRecord('u_f1_data');
f.get('u_property',propNum);
var fID = f.sys_id;
for (var j=0;j<maxInt;j++) {
var k = j+1;
var mrvs2 = i.variables.network_techs_update_f1_data_source;
var newRow = mrvs2.addRow();
newRow.nt_property_number.setValue(fID.toString());
newRow.interface_number.setValue(k.toString());
}
}
}
})(inputs, outputs);
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-08-2022 05:38 AM
There's one really silly error in my script:
var mrvs2 = i.variables.network_techs_update_f1_data_source;
should be
var mrvs2 = ritm.variables.network_techs_update_f1_data_source;
And then I need to have a ritm.update(); statement after the for loop.
Once I fixed these things, the script worked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-05-2022 01:54 PM
hello
i feel there is a problem in this line
var mrvs2 = i.variables.network_techs_update_f1_data_source;
can you please tell me where is "network_techs_update_f1_data_source" in the catalog item is it a variable in MVRS ?
OR
are you trying to add rows in another MVRS with the name as "network_techs_update_f1_data_source"

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-07-2022 09:19 AM
Sorry, I will clarify. (Please note, I did not do the initial build of this, so am not responsible for the variable names. š )
In the portal, the end user will specify (in the MRVS please_provide_the_property_number_s_and_associated_information) which devices need to be installed in the data center and will indicate how many network interfaces each device will need.
During fulfillment, the technician will need to provide the switch, card and ports each interface was connected to. Since there can be multiple interfaces per device, there is a second MRVS, network_techs_update_f1_data_source, where that information will be supplied by the technician via the catalog task.
This data needs to be completed when the task is closed, as it will be used to update records in another table. To avoid any data being missed, I am trying to create the necessary rows and set the known variables (via a flow action script) within the second MRVS, so that I can then apply some rules (via client scripts/ajax calls) to enforce the completion of the required variables within those rows.
Flow operation shows this step as completed with no errors, but no rows are added to the second MRVS.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-08-2022 05:38 AM
There's one really silly error in my script:
var mrvs2 = i.variables.network_techs_update_f1_data_source;
should be
var mrvs2 = ritm.variables.network_techs_update_f1_data_source;
And then I need to have a ritm.update(); statement after the for loop.
Once I fixed these things, the script worked.