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

@PritamG 

Can you explain which script is this?

I have seen this for the 1st time.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Juhi Poddar
Kilo Patron

Hello @Vaishali 11 

Try this script:

 

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue === '') {
        return;
    }

    var allowedGroups = ['sys_id_of_group1', 'sys_id_of_group2', 'sys_id_of_group3']; // Replace with actual sys_ids
    var assignmentGroup = g_form.getValue('assignment_group'); 

    if (assignmentGroup && allowedGroups.indexOf(assignmentGroup) >= 0) {
        if (oldValue && oldValue !== newValue) {
            var message = "Do you need to update the Service, Category, or Sub-Category?";
            var proceed = confirm(message);
            
            if (proceed) {
                g_form.getControl('hr_service').focus();
            }
        }
    }
}

The script ensures that the confirmation message popup appears only if the selected assignment group is in the predefined list of allowed groups.

Hope this helps!

 

"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"

 

Thank You
Juhi Poddar

 

@Juhi Poddar 

Seems your answer doesn't relate to the question asked.

Please verify the same.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Juhi Poddar i tried this script but it's not working

Ankur Bawiskar
Tera Patron
Tera Patron

@Vaishali 11 

what script did you start with and where are you stuck?

This is an easy requirement.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader