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

Use confirm("Press a button!"); Instead of alert and also to get the variable use g_form.getValue('variable value');

Hi 

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

I don't think there is a way to get sys id of record producer from table.

 You have to create custom field on the incident form and populate the sys id of the record producer. 

In the script field of the record producer you can add code to populate a field with the information you want. For example, say you have a field RC on incident table, where RC is a reference to the record producer table. In the script field in the RC, you can use current. u_rc = 'sys_id' of record producer.

Ankur Bawiskar
Tera Patron
Tera Patron

@srilakshmi 

Is this only for your learning purpose then you can have onChange catalog client script on Category variable and show the alert

Regards
Ankur

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

Hi @Ankur Bawiskar 

No this not for my learning purpose i got the requirement from the team

Can you please guide me with the code and hot to write it for varibale