RemoveIT catalogs from hr portal favorite widget

svani
Tera Contributor

Hi developers, 

 

We need help for one of the issue, 

We have created new hr portal, added favorite widget to it, but it's shows both IT and HR catalogs and articles favorite s, how to remove IT catalogs and articles and show only HR catalogs and articles. 

Filter only HR related. 

 

Any help would be much helpful. 

 

Thanks, 

Svani

6 REPLIES 6

@svani 

I investigated something and shared the details.

Please look into that and enhance further.

Do keep us posted once you get the working solution so that it helps other members in future.

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@svani 

whenever you add any item to favorites an entry is made to this table "sp_favorite"

this line brings the favorite in the Favorites widget

var favoriteApi = new sn_ex_sp.FavoriteAPI();

AnkurBawiskar_0-1745496698536.png

 

When you run this script in background it gives this

        var favoriteApi = new sn_ex_sp.FavoriteAPI();

        gs.info(JSON.stringify(favoriteApi));

AnkurBawiskar_1-1745496781875.png

 

Somehow you will have to manipulate this JSON which you get and ensure the further JSON i.e. processed JSON doesn't include the favorites which are with IT Catalogs

This you will have to do in the server side script

Take help from this link

How to hide catalog items in popular items? 

If my response helped please mark it correct and close the thread so that it benefits future readers.

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