- 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 07:41 AM
Hi,
in the advanced reference qualifier you will have to call script include
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: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 08:10 AM
thanks Ankur , it works
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2020 08:12 AM
Hi Ankur ,
Can you also help on this also
Three levels of approval on PCR Project change request 1) PM 2) Business Sponsor and IT Lead. Both must approve. 2a) If a rejection occurs, notify pm 3) Manager of the "abc" group 3a) when approved occur, notify the PM Weekly notification that runs daily: Any approval that is 5, 10, 15, 20, 25, and 30 business days old, send an email to the Approver and copy the PM. NOTE: once Closed Incomplete, the PM should be able to set it back and resubmit the PCR once fixed. Most of it is done but getting some challenges on the schedule notification part
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2020 08:14 AM
Hi Ankur ,
Can you also help on this also
Three levels of approval on PCR Project change request 1) PM 2) Business Sponsor and IT Lead. Both must approve. 2a) If a rejection occurs, notify pm 3) Manager of the "abc" group 3a) when approved occur, notify the PM Weekly notification that runs daily: Any approval that is 5, 10, 15, 20, 25, and 30 business days old, send an email to the Approver and copy the PM. NOTE: once Closed Incomplete, the PM should be able to set it back and resubmit the PCR once fixed. Most of it is done but getting some challenges on the schedule notification part