Unable to save the form due to client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2023 01:13 AM
Hi team,
i am unable to save the form due to agent is mandatory and setting back to none after saving the form.
My requirement is to add/remove options based on group. when ABC group is selected there are other two fields called agent and target based on agent selected target has to update the options.
i have created script include and client script but after saving it returning to none
script include:
returnIncGroup: function() {
var caseId = this.getParameter('group_id');
var gr = new GlideRecord('table_name');
gr.get(caseId);
if (caseId == gs.getProperty('propertyofgroupname')) {
return true;
} else {
return false;
}
},
onchange client script:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2023 01:25 AM
Hi @sasi,
Are these values also available as choices for the field?
Consider switching around your logic. Remove the values from the list you don't want to show by client script. And leave the ones that should be there.
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2023 01:36 AM
yes..but there plenty options to remove that is the reason i have choosed this method.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2023 03:13 AM
I understand, unfortunately the easiest option is not always the best. 😉
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2023 03:04 AM
Here is my script. First remove all the options, and then adds back what is needed depending on the Agent selected.
script include:
returnIncGroup: function() {
var caseId = this.getParameter('group_id');
var gr = new GlideRecord('table_name');
gr.get(caseId);
if (caseId == gs.getProperty('propertyofgroupname')) {
return true;
} else {
return false;
}
},
onchange client script:
if (newValue != oldValue) {
g_form.removeOption('u_target','Non Associate');
g_form.removeOption('u_target','Block');
g_form.removeOption('u_target','Facility');
g_form.removeOption('u_target','xyz');
.
.
.
.
g_form.removeOption('u_target','xyz');
}
Please mark my answer correct if you find it helpful.
Thanks,
Kavita Bhojane