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

Thanks alot


Hi,

I linked an article in my original response that explains the process to add underscore as a script include. If you follow that, with the only difference being that the name of your script include should be "_" instead of "underscorejs.min".

I am unable to get this to work. I am thinking the issue may be from the following:

if (_(data.related_lists).where({"type": "REL"}).length > 0) {
       data.related_lists = _(data.related_lists).map(function (item) {

               if (item.type === 'REL') {
                       item.definedRelationshipFilter = extractDefinedRelationshipsQuery(item.apply_to, item.apply_to_sys_id, item.table, item.relationship_id)
               }

               return item;
       });
}   

To do this, I added the following snippet of code directly under the snippet I showed above (note that I use underscore - you'll need to have that added in a script include)

 

If I leave it as is it gives an error related to the underscore "_" being used. You mentioned adding it to a script include. Can you expand on that for me? If I remove it I get no error but the related list displays all the records instead of those queried.

Hey @arthurcheung ,

 

can you share your the code of underscore.js used for creating the script include?

the github one is'nt working.

 

Thanks in advance

 

I'm trying to do the same, however I have multiple custom Relationships joining the same tables (User and Group Member) with different queries (group.type=whatever).

Looks like in this case, the first related list of the same table (Group Member) will apply the filter and tab content to all other related lists of the same table 😞

Don't really get it, because the for loop in data.related_lists should pass on the unique filters...

find_real_file.png