- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Everyone,
I am working on an Incident onChange Client Script where I need to automatically set the Assigned To field when the Assignment Group is set to "Network".
However, the script is not working as expected, and I am not sure what I am missing.
Below is the code I have written:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if (newValue === "Network") {
g_form.setValue("assigned_to", fred.luddy);
}
}
My requirement:
When Assignment Group = Network, Assigned To should automatically populate with a specific user.
Could anyone please help me understand what might be wrong here?
Thank you in advance for your support.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hi @DurgaPrasadCH,
The issue in your script is that you're trying to set the value using fred.luddy, which is not valid in a client script. The assigned_to field is a reference field and it expects a sys_id, not a display name or object reference.
Also, your condition must match the sys_id of the Assignment Group .
You should update your script like this:
// sys_id of Network group
if (newValue == 'NETWORK_GROUP_SYSID_HERE')
{
// sys_id of the user to assign
g_form.setValue('assigned_to', 'USER_SYSID_HERE');
}
If my response helped, please mark it as the accepted solution so others can benefit as well.
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution so others can benefit as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hi @DurgaPrasadCH,
The issue in your script is that you're trying to set the value using fred.luddy, which is not valid in a client script. The assigned_to field is a reference field and it expects a sys_id, not a display name or object reference.
Also, your condition must match the sys_id of the Assignment Group .
You should update your script like this:
// sys_id of Network group
if (newValue == 'NETWORK_GROUP_SYSID_HERE')
{
// sys_id of the user to assign
g_form.setValue('assigned_to', 'USER_SYSID_HERE');
}
If my response helped, please mark it as the accepted solution so others can benefit as well.
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution so others can benefit as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello Miftikhar,
I have tried the suggested steps, but the issue still persists. Kindly check on your side and provide the exact solution at your convenience

