- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2016 05:06 PM
Is there a way of hiding a group name from "Assignment group" field on the Change form till the New Change reached "Scheduled" status ?
Reason for this is there is a group which only needs to be selected after all the approvals are done. This group in turn bridges with a 3rd party tool & selecting this group before the change is approved, would prematurely bridge the change request.
I know you can do this on a choice list but not sure on how to hide a value in a reference field.
Any input would help me here !!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2016 01:04 AM
Hi Suhas,
- No, you don't have to use a script include. For an advanced refqual, you can specify "javascript:" with any valid javascript statments following it, including a call to a script include. But you can also just insert your statements right there in the advanced refqual. The advantage to calling a SI is that you could call a much more complex script... the refqual field does have a finite length which limits the amount of code you can enter there.
- If you want to list the 9 groups (out of 10) all the time, and include the 10th group when state=scheduled, use the second refqual I gave you (replace the group name and the state value with whatever you need):
javascript:current.state==-15 ? "active=true":"active=true^name!=Infrastructure NSW";
One important thing to note, I see in your query you were using "nameNOTInfrastructure NSW", which I don't think is a valid query... which would explain why you are still seeing all of the groups. An invalid query condition is ignored and all records are returned.
Instead you should be using "name!=Infrastructure NSW".
Try that and see how it works for you.
Thanks,
-Brian

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2016 07:38 PM
Turn on Debug Log.
Change the debug line
gs.print('enc: ' + encQry); //For debugging
What is the output (shown at the bottom of the list when it pops up)? Search for 'enc:'
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2016 09:50 PM
Got "enc: nameNOTInfrastructure NSW" in the debug log. But this group is present in the assignment group lookup.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2016 05:51 PM
You can write a script include for your reference qualifier to create advanced conditions.
For example
var RefQuals = Class.create();
RefQual.getGroupQury = function(gr) {
var qry = '';
if (gr.priority == 1) {
//If logic here
} else {
//Else logic here
}
return qry;
}
RefQuals.prototype = {
initialize: function() {
},
type: 'RefQuals'
};
Then on your field, select 'Advanced' as your reference qualifier and put
javascript:RefQuals.getGroupQuery(current);
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2016 06:01 PM
Hey Paul, Thanks very much for the Script Include mate.
But in the logic, is there a method for enabling a group name if (gr.state == 16) (this is the value for scheduled state) along with all the existing groups ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2016 02:04 AM
Hi Suhas,
You can use the below script include to achieve your result.
Step 1: Create one script include and use it under reference qualifier.
Script Include : getAssignmentGroup
Reference Qualifier : javascript:getAssignmentGroup(current)
Script Include;
function getAssignmentGroup(current){
if(current.state == '1') {
return "";
}
else{
return "name!=CAB Approval";
}
}
Here whenever the state is new in the assignment group field "CAB Approval"" group will not be visible. in other state the user can see the all the groups including
"CAB Approval".
BR/Vivek