- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2025 10:47 AM
I may get approvers as below by selecting them or through script.
I need to process them and get the User object sys ids and mails ? But I am getting empty list when I tried for sysIDs?
and also can I pass list of sysIds through script or do i need to pass there also objects and process them with same script??
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2025 02:32 AM
so your requirement is you are passing list of user records and then want to get emails for all those?
if yes then this worked for me
1) since you are passing a list of GlideRecord objects, simply iterate that using while
(function execute(inputs, outputs) {
// ... code ...
var userListRec = inputs.mylist;
var emailArr = [];
// iterate the object
while(userListRec.next()){
emailArr.push(userListRec.email.toString());
}
gs.info('emailArr' + emailArr.toString());
outputs.emailarr = emailArr.toString();
})(inputs, outputs);
Output:
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2025 10:54 PM
@Ankur Bawiskar can you pls look into this if possible?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2025 11:17 PM
what's your actual business requirement?
did you give correct output type for your action?
what input you are passing and what you require?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2025 12:03 AM - edited 04-20-2025 12:04 AM
You can see below link more or less I am having same business logic and script. I have used your correct script only However my requirement slightly changed so that I have changed inputs from reference to list user and list group so that people can select multiple users or multiple groups.
also while they are passing parameters some times they can push the values to action through input script instead directly passing the values.?
This is where I am trying to work on it.
And out puts are remains string fields only as they just pass out emails and sys_Ids as outputs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2025 12:06 AM
so in your above action what's not working?
I don't know what you action takes and what debugging did you perform?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader