- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2019 04:22 AM
Variable set type is Multi-Row Variable Set with below three Variables:
Application: type Look up Select Box.
Application Role: type Look up Select Box.
Application Scope: type Single Line Text.
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord('sc_task');
gr.initialize();
gr.short_description = 'Demo short description';
gr.description ='Application: '+ current.variable_pool.application+ //prints: undefined
'Application Role: '+current.variables.select_application.application_role+ //prints: [], emply array. select_application is a variable set.
'Application Scope: '+current.variables.application_scope; //prints: undefined
gr.request_item = current.sys_id;
gr.parent = current.sys_id;
gr.insert();
})(current, previous);
Here, with the help of Business rule I am creating catalog task and printing values of Variables in Description of the task.
Solved! Go to Solution.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2019 04:30 AM
Hi there,
You can use current.variables.internal_name_of_the_mrvs to get your hands on the JSON which for the MRVS concerned. An example (= tested) on our environment:
gs.info(current.variables.u_staff_cost);
Resulted in:
[ {
"details4" : "other_general_expenses",
"date4" : "06-08-2019",
"amount_eur4" : "99,99",
"description4" : "xxx"
} ]
Kind regards,
Mark
---
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2019 04:30 AM
Hi there,
You can use current.variables.internal_name_of_the_mrvs to get your hands on the JSON which for the MRVS concerned. An example (= tested) on our environment:
gs.info(current.variables.u_staff_cost);
Resulted in:
[ {
"details4" : "other_general_expenses",
"date4" : "06-08-2019",
"amount_eur4" : "99,99",
"description4" : "xxx"
} ]
Kind regards,
Mark
---
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2020 04:15 AM
below is is very efficient way than Glide 'sc_multi_row_question_answer' table .
Here is my working script.
(function executeRule(current, previous /*null when async*/ ) {
var mrvs = current.variables.vendor_information;
var totalRows = mrvs.getRowCount();
var total = 0;
for (var i = 0; i < totalRows; i++) {
total = total + mrvs.getRow(i).getCell('vendor_price').getCellDisplayValue() * mrvs.getRow(i).getCell('quantity').getCellDisplayValue();
}
var req = new GlideRecord('sc_request');
req.get(current.request);
req.price = total.toFixed(2);
current.price = total;
})(current, previous);