- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2025 01:08 AM
I have a requirement where when after the case is created and then the assigned to is assigned or is changed then there should be a message or a pop-up to change the service, category & sub-category if needed. How can this be done?
Thanks in advance!!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2025 01:06 AM
I have created an on change client script like below and it worked.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var assignmentgroup = g_form.getValue('assignment_group');
if (assignmentgroup == 'sys_id of the group') {
g_form.showErrorBox('field_name', 'message');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2025 01:21 AM
You can create a onchange client script on the case table.
Onchange of 'assigned to' field, alert the message.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2025 01:25 AM
Hi @Priyankagupta thanks for the response. But this should apply for few assignment groups only and not all that are present in the system.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2025 01:33 AM
@Vaishali 11 , you can add an if condition in the onChange client script.
When the 'Assigned To' field changes, check if the selected user belongs to any of the specified groups. If they do, display an alert message.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2025 01:43 AM
you can achieve this in ServiceNow using a client script (onChange) on the assigned to field.
firstly create a client script on the case table.
then set type to onChange.
trigger the script on the assigned to field.
use a confirmation pop-up or alert to notify the user to update service, category, and sub-c
(function executeRule(current, gForm, gSNC) {
gForm.addChangeListener('assigned_to', function() {
gForm.confirm("Do you want to update the Service, Category, and Sub-Category?", function(confirmed) {
if (confirmed) {
gForm.setValue('category', '');
gForm.setValue('subcategory', '');
gForm.setValue('service', '');
}
});
});
})(current, gForm, gSNC);