How to override the Script Include QuickLinkUtilSNC by using the QuickLinkUtil script include?

Bhoomika M
Tera Contributor

I am trying to configure to get the quick link card in the portal depending on the logged in user's role in the Employee center portal. I have HR, IT, Finance, Procurement and Work place, when a HR Admin logs in he has to see only the quick link of HR.

Tried overriding the OOTB QuickLinkUtilSNC Script Include via QuickLinkUtil script include. I am trying to override the fetchQuicklinksForHomePage function but I am unsuccessful.

So far all my efforts have not been successful. Can someone please just give me a little guidance on the code where I should add the override and what it should look like and include?

 

Below is the script for easy reference:

var QuickLinkUtil = Class.create();
QuickLinkUtil.prototype = Object.extendsObject(QuickLinkUtilSNC, {
initialize: function() {
QuickLinkUtilSNC.prototype.initialize.apply(this, arguments);
},

type: 'QuickLinkUtil'
});

 

2 REPLIES 2

Aman Kumar S
Kilo Patron

Hi @Bhoomika M ,
You just need to declare the function as in the SNC script include and add your logic, it will automatically override the SNC script include. Lets say you want to override fetchQuicklinksForTopic function, it will be as follows, no other changes needed.

var QuickLinkUtil = Class.create();
QuickLinkUtil.prototype = Object.extendsObject(QuickLinkUtilSNC, {
    initialize: function() {
  QuickLinkUtilSNC.prototype.initialize.apply(this, arguments);
    },
fetchQuicklinksForTopic: function (topicId) {
//your new logic
},
    type: 'QuickLinkUtil'
});
Best Regards
Aman Kumar

@Aman Kumar S After making changes which SI we need to call, the custom SI in which we are overriding the OOTB function or the OOTB (SNC).