- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-06-2015 07:03 AM
I have an onChange Client Script, that is suppose to populate the assignment group on the incident form, based on some condition.
The logic seems to be working, in that the field is getting populated with the right value, but it is not linking correctly to the group table (it references none available). Which in turn, when trying to save the record, throws an error.
Client Script
function onChange(control, oldValue, newValue, isLoading) {
var ga = new GlideAjax('checkOSP');
ga.addParam('sysparm_name', 'getOPS');
ga.addParam('sysparm_ci', g_form.getValue('cmdb_ci'));
ga.getXMLWait();
//alert(ga.getAnswer());
//var answer=ga.getAnswer;
//alert(answer);
if (ga.getAnswer() == "DELL"){
g_form.setValue('assignment_group',"Dell Group");}
if (ga.getAnswer() == "CSI GLOBAL EDUCATION INC"){
g_form.setValue('assignment_group',"CSI Support");}
if (ga.getAnswer() == "ECCA"){
g_form.setValue('assignment_group',"ECCA - Infotech");
if (ga.getAnswer() == ""){
g_form.setValue('assignment_group',"Server Support");}
}
Script Include
var checkOSP = Class.create();
checkOSP.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getOPS: function() {
var a;
var cmdb_ci_sys_id=this.getParameter('sysparm_ci');
var ci = new GlideRecord('cmdb_ci_hardware');
if(ci.get(cmdb_ci_sys_id))
a=ci.u_operations_support_provider;
else
a="not found";
return a;
}});
Solved! Go to Solution.
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-06-2015 07:06 AM
Hello Rachelle,
The problem seems to be that the assignment group is a reference field. You need to set the value of the field to the sys_id of the group, not the name. Substitute Dell Group for example for the sys_id of that group and it should work. Possibly it would be better to get the sys_id out of the script include.
Thank you.
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2015 10:50 PM
Rachelle,
Please mark answers as helpful/correct if they helped you get to the solution. If you feel like your issue hasn't been resolved, please let us know.
Thank you.