The CreatorCon Call for Content is officially open! Get started here.

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

Ashish,



I just added some lines of code to a clone of the "SC Catalog Item" Widget - see attached screenshots. Getting the category worked fine for me.


I recommend using console.log() for all debugging of widgets, it even works in the server script part!



The element in the data.category array is called name, not title.


You also should ideally not declare your variable twice - just initialize it e.g. with true and set it to false if needed (or vice versa).



Cheers


Frank


Hey Frank, You forgot to attach the Screenshot. Please attach !!


fschuster Please can you share the mentioned Screenshots.


Ashish, not sure if you have just overlooked them - but I can even see them when I'm not logged in into the community from my mobile.



They are not inline images, you have to look at the attachments.


IMG_8004.PNG


Hey Frank,



Can You help me with the ng-show for a button.


Now I am able to fetch the Category in the logs but Either the button gets visible for all or None.



It is not following the condition passed in server Script.



As You suggested I am using a variable to set the visibility in HTML



<button ng-show="showCat" .......................>



This is BUTTON is Submit Button at the SC Catalog Item Widget.



Please guide ...