Country field display Sysid in flow designer body
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2024 04:47 AM
Hello guys,
Please can someone be kind enough to help me edit below Script using specified information:
Field name: Country
Travel location field name: u_country_name
Ref Table : u_travel_locations
Script:
(function execute(inputs, outputs) {
var ids = inputs.variable.toString().split(','); //Assuming varaible contain comma-seperated Sys IDs
var userNames = [];
ids.forEach(function(id) {
var gr = new GlideRecord('sys_user'); // using 'sys_user' because it is the user table
if (gr.get(id)) {
userNames.push(gr.name.toString()); // Extracting the 'name' field from each user record
}
});
outputs.variable = userNames;
})(inputs, outputs);
I originally created a "List collector array" for name field displaying as SysId using below script in Action designer and it worked. Now I would appreciate help with similar script to display Country name instead of SYSID in the body of the flow designer email template.
Below is the screenshot of the name translation from SYSID to Displayname
Thank you inadvance for your assistance and Time.
Regards
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2024 04:55 AM
A list field will contain the sys_id's, so if you use that outcome to show in something else, you will have the sys_id. You will need to do a lookup to the record with this sys_id and get the name from that record. So just a simple step in between.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark