- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2025 04:24 PM - edited ‎01-24-2025 04:27 PM
I am trying to create a recipient list from Business Application owners, both IT and business. I can pull one or the other, as seen in the screenshots, with the dynamic fields and filtering. However, this creates two lists, one for business owners and one for IT Owners. I need logic/script that pulls both owners into a single list. I am using SYS ID to mitigate duplicates and omissions of individuals with the same name.
table: cmdb_ci_business_app
business owner: owned_by
IT Application Owner: it_application_owner
 
 
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2025 10:57 AM
Hello @Bryant9 ,
You can achieve this using a script.
Check the below script:
(function() {
var userList = [];
var taskGr = new GlideRecord("cmdb_ci_business_app"); // Table name
taskGr.addEncodedQuery('install_status!=3') // Conditions for filtering
taskGr.query();
while (taskGr.next()) {
var ownedBy = taskGr.owned_by; // Business Owner
if (ownedBy && ownedBy.toString())
userList.push(ownedBy.toString());
var itApplicationOwner = taskGr.it_application_owner; // IT Application Owner
if (itApplicationOwner && itApplicationOwner.toString())
userList.push(itApplicationOwner.toString());
}
var uniqueUserList = new global.ArrayUtil().unique(userList); // Unique from the Array created
var obj = {'internal' : uniqueUserList};
return obj;
})();
If the above information helps you, Kindly mark it as Helpful and Accept the solution.
Regards,
Najmuddin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2025 10:57 AM
Hello @Bryant9 ,
You can achieve this using a script.
Check the below script:
(function() {
var userList = [];
var taskGr = new GlideRecord("cmdb_ci_business_app"); // Table name
taskGr.addEncodedQuery('install_status!=3') // Conditions for filtering
taskGr.query();
while (taskGr.next()) {
var ownedBy = taskGr.owned_by; // Business Owner
if (ownedBy && ownedBy.toString())
userList.push(ownedBy.toString());
var itApplicationOwner = taskGr.it_application_owner; // IT Application Owner
if (itApplicationOwner && itApplicationOwner.toString())
userList.push(itApplicationOwner.toString());
}
var uniqueUserList = new global.ArrayUtil().unique(userList); // Unique from the Array created
var obj = {'internal' : uniqueUserList};
return obj;
})();
If the above information helps you, Kindly mark it as Helpful and Accept the solution.
Regards,
Najmuddin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-27-2025 06:41 AM
Works like a dream. Thank you, @Najmuddin Mohd!