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

Thanks for the reply.
What script do I need to include?

Deepshikha 3010
Mega Guru

Hii miyu,

In client script write OnChange() client scritpt:

 

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

alert('my category is'+np);

 

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

Thanks

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!

Thanks Anirudh, Can you suggest on similar type of reuqyest. https://community.servicenow.com/community?id=community_question&sys_id=f7e70a4fdb4c51182454e6be1396199c