- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2020 10:40 PM
Hello all ,
I have to filter the values showing in a list type field which is referring to Business Unit table. I don't want to show those values which are parent to any other BU. It means if a BU has a child then only the child BU should be available and not the parent one
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2020 07:46 AM
Hi,
Something like this
Script Include:
var CheckRecords = Class.create();
CheckRecords.prototype = {
initialize: function() {
},
getRecords: function(){
var arr = [];
var gr = new GlideRecord("bu table"); // use valid table name here
gr.query();
while(gr.next()) {
var gr1 = new GlideRecord("bu table"); // use valid table name here
gr1.addQuery("parent", gr.sys_id); // use valid parent field here
gr1.query();
if (!gr1.next()) {
arr.push(gr.sys_id.toString());
}
}
return arr.toString();
},
type: 'CheckRecords'
};
How to call in reference qualifier
javascript: 'sys_idIN' + new CheckRecords().getRecords();
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2020 06:51 AM
Hi Ankur ,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2020 07:09 AM
Hi John,
I wanted to check how you are identifying relationship between child and parent BU
List field is on demand table and refers BU table.
Example: BU001 is parent of BU002 so which field on BU says BU002's parent is BU001
Any field?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2020 07:20 AM
Hi Ankur i didnt get the question , can you please elaborate ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2020 07:22 AM
This is how a BU looks like. Here for example, Asia is parent of Asia 2nd. So if I click on magnifying glass to select a BU, I don't want Asia to appear on that list because it is parent of other BU.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2020 07:23 AM