How to set multiple variable values in a single variable using Run Script(workflow)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2022 02:52 AM
After creating Request, few variables like,
variable 1 : A
B
C
D
variable 2: A1
B1
C1
variable 3:A2
B2
C2 etc
In Variable 4(multiple line text)the above 3 variable values should populate with semicolon and space for each value.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2022 04:56 AM
Hi ,i want to populate multiple variable values into one variable and each value should be populated with semicolon and space.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2022 05:02 AM
Hi,
Answer mentioned by Rohila should work, could you please share your script and output with more details so that we can help you further.
Thanks and Regards
Abhijit
Regards,
Abhijit
ServiceNow MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2022 06:58 AM
Hi Anusha,
Add getDisplayValue() and check.
Tested in BG script:
var gr=new GlideRecord("sc_req_item");
gr.addQuery("sys_id","7a5e0bef1b59cd10558d639bbc4bcb75");
gr.query();
if(gr.next())
{
gs.info(gr.variables.select_any_one.getDisplayValue());
}
Variable value in RITM:
O/p I got:
Hope it helps
Thanks
Murthy
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2022 07:51 AM
Hi murthy,
need to populate multiple variable values into one variable with semicolon for each value .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2022 08:47 AM