- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2015 08:24 AM
I am trying to using a onChange Client Script to clear the value of the Assigned To field when the Assignment Group changes. I tried to use the one that was posted on the messages, but it is not working.
Here is what I have:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return;
}
if (newValue == ''){
g_form.setValue('assigned_to','');
}
}
This is not working, any suggestions?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2015 10:07 AM
Hi Vinay,
Below script will blank out the assigned_to field when the assignment group changes.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return;
}
var assGrp = g_form.getControl('assignment_group');
if(assGrp.changed)
{
g_form.setValue('assigned_to','');
}
//Type appropriate comment here, and begin script below
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2016 08:17 PM
Hi All,
I have the same issue and I would like to apply this change to one particular Catalog Item. Can I do this by selecting sc_req_item Table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2016 07:53 AM
You can write a catalog client script there you have a option to apply it to a particular catalog item.
Mark Correct if it solved your issue or hit Like and Helpful if you find my response worthy.
Thanks,
Deepa
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return;
}
var assGrp = g_form.getControl('assignment_group');
if(assGrp.changed)
{
g_form.setValue('assigned_to','');
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2016 07:47 AM
Hi Suraj,
Could you please give me the steps where I can implement this code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2016 01:31 AM
I see people still need help with this although it's an old question. Just found an easier (less coding) way to do it.
Steps are as follows:
- System Definition > Client Scripts > New > Name = Clear Assigned to > Table = Incident [incident] or Catalog Task (depending on which table you need this to work on) > Type = onChange > Field name = Assignment group > Description = "This script will clear the assigned to field when the assignment group changes" > Script :
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return ;
}
if (g_form.getValue('assigned_to') != '') {
g_form.setValue('assigned_to', '', '');
}
}
I found this script somewhere on community or wiki can't remember exactly but it works perfectly.
I also had the issue where I needed the "Assigned to" to only be available for write after the Assignment group has been chosen. UI Policy as follows:
- System UI > UI Policies > New > Table = Incident or Catalog Task > Conditions > Assignment group = is empty > Right click header and Save > At bottom of page > UI Policy Actions > New > Read only = true > Field Name = Assigned to > Submit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2017 07:01 AM
This worked for me. I'll note in case anyone else wants to do it this way, I actually associated the client script with the 'Task' table and then selected the 'Inherited' box to ensure it works on all extensions of the Task table (incidents, sc_task, problem, etc.). I wanted this to work universally (see below for my *final* version).
Thank you everyone!