Override Reference Qualifier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2015 12:51 PM
Hi-
Background: On my Incident table I have a Reference Qualifier that auto populates the assignment group based on the CI selected. Before I made changes the default assignment group value could be overwritten and changed to a different assignment group.
I changed the Reference Qualifier to Advance with javascript: 'parent=' + current.cmdb_ci.support_group so that nowitnot only defaults the assignment group based on the CI, the lookup reference filters will only show me the children of this group so that I can refine my group (to a location based group).
What I need:
A - Need to ability to default the assignment group so that the lookup only shows thechildrengroups for the given CI - but also be able to still override the default CI with a different CI (and if that new CI has children change the lookup to show the "new" children).
B - HIDE theorginial default assignment group (use it to populate the childlookupif there are any) but need the user to SELECT an assignment group (if there are child groups) and not just go with the default assignment group.
I don't know how to write ascripto do any of this (or where you put it)....anyassistance will be greatly appreciated.
April
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2015 09:53 PM
Hi April, the best way to accomplish this is through assignment rules. Please refer to the following link for further information about it: http://wiki.servicenow.com/index.php?title=Defining_an_Assignment_Rule_for_Incidents#gsc.tab=0
Assignment rules are evaluated in order, and it will stop evaluating as soon as one of the rule succeeds. The way of defining a default one is to define one with the highest order which is always assigned if none of the other assignment rules succeeded.
If within your CIs you have defined your support groups, then an assignment group could look like the following:
Applies to (condition😞
- Configuration item is not empty
- Configuration item.support group is not empty
Script:
current.assignment_group = current.cmdb_ci.support_group;
Simple as that!!
Then you can have a default assignment group which just leverages the Assign To and there you can select the group that should be defined per default.
I hope this is helpful!
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2015 04:14 PM
Thanks Berny for your assistance. Let me explain what I'm doing a different way.... becauseIdon't believe that an assignment rule will work
- I added a new field to the CI record that indicates whether the assignment group associated with the CI should auto-populate on an incident form or not. The new field will be a checkbox. The label will be "Disable Auto-populate Assignment Group on Incidents?"
- I need to create a rule to the incident form that will evaluate the value of the checkbox field on the CI and if the box is checked, the Assignment Group will NOT auto-populate on the incident form. The assignment group lookup table will show the "parent" Assignment group that is assigned to the CI and the Child Assignment groups of the "parent" group
- If the checkbox is not checked on the CI record, the Assignment Group will continue to auto-populate the assignment group that is associated with the CI.
- The Service Desk agents will be instructed to select the correct assignment group based on location (that is what the child groups are) when the assignment group does not automatically populate.
- If the Incident has to be reassigned to a different group, then the CI has to be blanked out or changed. The notion is that if the incident needs to be reassigned, the issue must be associated to a different CI than the one originally chosen.
- The CI has both an Assignment Group field and a Checkbox called Disable Assignment Group.
- Currently I am using a reference qualifier (dictionary entry on the assignment group field on the inc form) (that is working) to auto populate the assignment group for the selected CI if there are any group children the lookup shows only the children for the assignment that was auto populated. (answer = 'parent=' + current.cmdb_ci.support_group )
I created the following Script Includes:
with this scrip:
varu_INC_FilterAssignmentOnDisableTrigger = Class.create();
u_INC_FilterAssignmentOnDisableTrigger.prototype = {
initialize: function() {
},
type: 'u_INC_FilterAssignmentOnDisableTrigger'
//if(current.sys_class_name == 'incident') {//tomakesurethefilter is only on the incident table
varcurrent_source = current.cmdb_ci;
varanswer= current.assignment.group;
if(current.cmdb_ci. u_disable_auto_populate_assign == true) {//return parent - child assignment groups
answer= ''parent=' Current.assignment.group+ current.cmdb_ci.support_group';
}
if(current.cmdb_ci. u_disable_auto_populate_assign =!true) {//return group assigned to cmdb_ci
answer= 'assignment.cmdb_ci';
}
returnanswer;
}
return'';
}
**********************
But as you can see I am getting an error and I don't know how to fix it.... Once I can get this to work I believe my next step would be to create a reference qualifier javascript: u_INC_FilterAssignmentOnDisableTrigger....... Am I on the right track? (this is my first attemp a scripting or using script includes)
Any assistance would be greatly appreaciated.
April
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2015 11:25 PM
Hi April, you're trying to accomplish quite a bit. More than perhaps a punctual community thread can handle. Lets try to get your script fixed before getting into other items:
a) I will first recommend you do a classless script include if you're going to call it from your reference qualifier. The script include needs to have the same name as the function. It's syntax is something like the following:
function u_INC_FilterAssignmentOnDisableTrigger(){
//your logic goes here
}
b) your reference qualifier needs to end up building an encoded query and it's not clear on your code if you want to retrieve a groups of sys_id of assignment groups to do something the following:
javascript: 'sys_idIN' + u_INC_FilterAssignmentOnDisableTrigger()
or do build the encoded query within the script include, since you have the following line 14
answer= ''parent=' Current.assignment.group+ current.cmdb_ci.support_group';
c) Also, in your line 14, "Current" should be in lowercase
d) In the same line 14, the syntax has various problems; but I'm totally clear if this is the intended logic you're looking for.
something like the following should be right:
answer= ''parentIN' + current.assignment_group + ',' + current.cmdb_ci.support_group;
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2015 07:44 AM
Thanks Berny,
I've updatedmy code to:
functionu_INC_FilterAssignmentOnDisableTrigger()
//Create function to call in referencequalifier to evaluate the value of the checkbox field on the CI and if the box is checked, the Assignment Group will NOT auto-populate on the incident form but rather providethe parent and child assignment groups to select from
{
varcurrent_source = current.cmdb_ci;
varanswer = current.assignment.group;
if(current.cmdb_ci.u_disable_auto_populate_assign == true) //return parent - child assignment groups
answer= ''parentIN' + current.assignment_group + ',' + current.cmdb_ci.support_group;
if(current.cmdb_ci.u_disable_auto_populate_assign =!true) //return group assigned to cmdb_ci
answer= 'assignment.cmdb_ci';
returnanswer;
}
return'';
}
Buti'm still getting the following errors:
WARNING at line 9: Missing semicolon.
ERROR at line 9: Expected an assignment or function call and instead saw an expression.
Any ideas?