POp-up message

Vaishali 11
Tera Guru

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!!

1 ACCEPTED SOLUTION

Vaishali 11
Tera Guru

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');

}

View solution in original post

12 REPLIES 12

Priyankagupta
Giga Guru

@Vaishali 11 ,

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! 

Hi @Priyankagupta thanks for the response. But this should apply for few assignment groups only and not all that are present in the system.

@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!

PritamG
Mega Guru

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);