Substitute com.glideapp.servicecatalog_category_view with com.glideapp.my_custom_view

Greg42
Mega Guru

Hi All,

I am trying to change the way items/categories are displayed it a catalogue - namely, to display it as a grid not a list. I don't want to change existing code from obvious reasons. I did some research and looked around the system of how those thing work together but can't see where the link item - using SNC.CatalogURLGenerator - generates com.glideapp.servicecatalog_category_view - can't see source code for it anywhere. I would like to change it to my custom view allowing me to work on it without worrying about future updates.

Is there a way to change the path generated by CatalogURLGenerator to point somewhere else than default com.glideapp.servicecatalog_category_view?

Any help will be much appreciated.

Cheers

Greg

1 ACCEPTED SOLUTION

Greg42
Mega Guru

I have managed to style the view as I wanted. Used addLoadEvent and checked for com.glideapp.servicecatalog_category_view.do then used jQuery for styling.


View solution in original post

39 REPLIES 39

User166992
Tera Guru

Hello Greg,



I'm also having similar requirements. But unfortunately code is not working in our Instance.


Can you suggest some other workaround?



Thanks,


Jaikumar


Hi Jaikumar,



If you have it as UI Script global active the only thing I can think of is jQuery. Do you get any errors while loading catalog pages? I have just quickly checked it in fuji and it worked fine there too. What version is your instance on? (But I don't really think the version is the problem here)




Cheers



Greg


Hello Greg,



Thanks for the quick response. Basically, I don't see any error. Code executes properly. But I'm not getting proper output.


Please find below screenshot



ServiceCatalog View.png


We are on Eureka release.



Thanks,


Jaikumar


Hi Jaikumar,



No problem. Ah yes, you need to change the code that looks for headers as Id. I assumed default names for Items and Categories.


As comment says:



  1. !!! Caution !!!
  2.   Each time a title in the header is changed, the code needs to be adjusted as well.
  3.   Make sure the header title in html is the same as in if conditions!
  4.   Additionally, if you work in multi language environment this code will not work
  5.   - as checks basically work on hard-coded strings - and a workaround needs to be
  6.   implemented to resolve this issue.

Change line 88 from:




if (value.textContent.trim() === "Categories")




To:




if (value.textContent.trim() === "Related Categories")




and that should do it.




Cheers




Greg


I have tried again after updating line #88, but still the output is same



Thanks,


Jaikumar