Display popup when selecting a category in the service catalog

miyu
Tera Guru

I would like to write a client script that will display a popup when a category is selected.
But I don't know how to write it.
Please let me know.

 find_real_file.png

1 ACCEPTED SOLUTION

AnirudhKumar
Mega Sage
Mega Sage

The screenshot shows a portal page.

To show a pop here, we need to update the Categories widget on the left. (This is not simple, but let me try my best to guide you)

 

Navigate to sp_widget table, and open the record with name SC Categories.

You will find that the page is readonly. Now we need to clone the widget.

(Remember to recreate the Angular Provider(related list) for your new widget).

 

Now 2 major updates need to be done : 

1. Link the new widget to the sc_category page(you need to go to the sp_page table for this)

2. In your new widget, update the $scope.categorySelected function with extra script in the Client Controller.

 

Your extra script should call a modal window.

Check

https://www.w3schools.com/bootstrap4/bootstrap_modal.asp

 

 

 

Long Live ServiceNow!

View solution in original post

13 REPLIES 13

I'm sorry.
Do you know how to make a popup appear here?

Rameshwar Khile
Mega Expert

Hi,

 You can refer following video for better understanding of client script and to solve above problem.

https://www.youtube.com/watch?v=KmGLoj8v7E4

https://www.youtube.com/watch?v=iY5WsFMRAuo

 

Please mark reply as Helpful/Correct, if it is helpful for you.

Thanks

Murthy Ch
Giga Sage

Hi @miyu 

 

Write OnChange() client scritpt:

 

var abc=g_form.getValue('category');

alert('The selected category is:'+abc);

 

 

Thanks,

Murthy

Thanks,
Murthy

Thank you for your reply.
I'd like to have a popup here in the ServicePortal.
Do I need to write this script?

find_real_file.png

Hi @miyu 

 

For that u need to modify the widget script.

 

Thanks

 

Thanks,
Murthy