Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to Set Widget Visibility... Service Portal

ashishgupta
Tera Expert

1. I have a requirement to have a particular widget for a special category of the Service Catalogs.

Please can you help me out in setting the visibility of particular widget over "sc_cat_item" page for a special category of the Service Catalogs.

2. Also, I want to hide the Submit Button on the "SC Catalog Item" widget for particular service Catalog.

ctomasi

pradeepksharma

b-rad

26 REPLIES 26

Hi Ashish,



My knowledge of Service Portal is almost non-existent at this point. I wish I could offer help, but I'm not a subject matter expert in this area (yet). Sorry.


Thanks for reply



ctomasi Please can you route it to some Service Portal Expert.


Just Tag anyone..


fschuster - any thoughts?


Have your server part of the widget set "visibility" variables based on the according category (use case 1) and the according catalog (use case 2).


E.g. "if(myCategory == xyz)" - set a variable, e.g. "showCategory" to "false".



These variables could e.g. come from Widget Options or System Properties.



Then you will have to add an ng-show/ng-hide on the HTML level that evaluates the visibility expression and either shows or hides the <div> or the <button>.


E.g. (ng-show="showCategory") - meaning only if showCategory is true, we will display that element.


Hi Frank,


Thanks for the reply.



I am creating a widget that is responsible for accepting the usefulness of the Service Catalog Items:



Server Side Script:



find_real_file.png



All three Highlighted Logs Results are:


find_real_file.png



Please can you guide me in achieving the Selected Catalog's Category.   None of the above logs are able to fetch the category.



Once I am able to achieve the Category I can easily compare and use ng-show in HTML against <div>