Free Service Portal Widget: Related Lists

nathanfirth
Tera Guru

To help contribute back to the community, we're going to try to develop and give away one new widget per month.

For January we have developed the "Related List" widget, which allows you to display related lists on the form page in Service Portal.

Example below from a service catalog request:

Screen Shot 2017-01-12 at 10.20.55 AM.png

To download the widget, it's available on ServicePortal.io: Free Widget of the Month - ServicePortal.io - Service Portal, CMS, and Custom Apps

65 REPLIES 65

Hi Nish,



That code snippet looks right, as it just looks like the code directly from the widget.



What are your thoughts from the results you see from the test harness widget?



Cheers,


Arthur


Hello Arthur Cheung,


                                                I have implemented the way you have told in the steps. But i am confused with the underscoremin.js . I followed the steps in the document you have attached. But still getting the error that underscore is not defined. Any suggestions or solution ?




Thanks,


Ruthra.v


Hi Ruthra,



I forgot to mention one small note required while adding underscore.



As per the instructions on that site, you would have added into a script include named "underscore-min.js". As shown on that site, in normal back end scripts (as opposed to server scripts in widgets), you could then use underscore in your script after including it using:  


gs.include('underscore-min.js');   

However, it appears server scripts in widgets work a bit differently. From my observations, I think they automatically include script includes. However, in this fashion, you need to call the script include via the name of the script include. So if you named it "underscore-min.js" you would need to call it by that name. Of course, this makes it very cumbersome to call in the code (not to mention the period in the name probably provides you problems as well).



So... TL;DR:


Just change the name of your script include to "_" instead of "underscore-min.js", and it'll work.



Cheers,


Arthur


Hello Arthur,



Thanks a lot. That solved the issue.



Regards,


Heera


Thanks for this info Arthur. We were close to fully building this out ourselves and you saved us a lot of time and heartache. Cheers!