How to create a popup on incident form for a service field

srilakshmi9
Mega Contributor

Hello,

we have one record producer named as "Report an Issue" , Upon selection of "category" in "report an issue" record producer pop up is coming to display that you are raising issue for "name of the service" service and have a user clickable option "Ok".

Could you please help me on this

1 ACCEPTED SOLUTION

Hi,

there is another checkbox on Catalog Client Script:

Applies on Target Record

If you select this checkbox then it would run on the form as well

find_real_file.png

Regards
Ankur

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

View solution in original post

38 REPLIES 38

Hi,

when you use alert box of javascript you can give your text or message there which should come and should be seen to user

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
        if ( newValue == '') {
            return;
        }
        
if(newValue == 'your value')
{
alert('This is my text for alert');
}

}

Regards
Ankur

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

Hi Ankur,

Yes i have tried below code and it is working as expected but this client script should work only for particular record producer and also one thing  as shown in below screenshot the sys id is displaying but it should display the name of the service 

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

if(newValue != '') // add the category value of your choice
{

var service =g_form.getValue('business_service');
confirm("Your company is " + service +", do you want to continue?");
}


}

 

find_real_file.png

Hi,

For making it work only for your record producer you need to select the catalog item i.e. your record producer in the Catalog Item field during catalog client script creation

Also for getting the name instead of sys_id use this

function onChange(control, oldValue, newValue, isLoading, isTemplate) {

if(newValue != '') // add the category value of your choice
{

var service =g_form.getDisplayBox('business_service').value;
confirm("Your company is " + service +", do you want to continue?");
}
}

Select your record producer in the Catalog Item field

find_real_file.png

Regards
Ankur

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

If I create a client script for record producer will the alert msg will appear on the incident form when the category field changes?

No it won't .

As you will create catalog client script of record producer and normal client script for incident.