How to set a menu to open links in new tab in the Service Portal?

Alok21
Giga Expert

Hi Team,

I know that there's not an option for setting a Menu Item to open in a new tab. I tried to update _blank and _spd in the URL target field in menu item form but it is not working and on click it is opening in the same tab. 

Any input is highly appreciated.

Regards,

Alok sahu

1 ACCEPTED SOLUTION

Alberto Consonn
ServiceNow Employee
ServiceNow Employee

Hi,

try the solution suggested to the below thread, it should work:

https://community.servicenow.com/community?id=community_question&sys_id=afa00765db98dbc01dcaf3231f96...

If I have answered your question, please mark my response as correct and/or helpful.

Thank you very much

Cheers
Alberto

View solution in original post

21 REPLIES 21

Alberto Consonn
ServiceNow Employee
ServiceNow Employee

Hi,

try the solution suggested to the below thread, it should work:

https://community.servicenow.com/community?id=community_question&sys_id=afa00765db98dbc01dcaf3231f96...

If I have answered your question, please mark my response as correct and/or helpful.

Thank you very much

Cheers
Alberto

Hi Alberto,

I did made the changes as per the above thread but it is still not working.

Below is the code in Angular ng-template.

 

<a ng-if="item.items.length == 0 && !item.scriptedItems && !item.u_new_window" ng-href="{{item.href}}">{{ item.label}}</a>
<a ng-if="item.items.length == 0 && !item.scriptedItems && item.u_new_window" ng-href="{{item.href}}" target="_blank">{{ item.label}}</a>
<a role="menuitem" aria-haspopup="true" ng-if="item.items.length > 0" href class="dropdown-toggle sp-menu-has-items" data-toggle="dropdown" aria-controls="{{::item.label.split(' ').join('')}}" aria-haspopup="true" title="{{::item.hint}}">
<fa ng-if="::item.glyph" name="{{::item.glyph}}"></fa>
<span ng-bind-html="::item.label"></span> <span class="caret"></span>
</a>
<ul ng-if="item.items.length > 0" class="dropdown-menu" role="menu" id="{{::item.label.split(' ').join('')}}">
<li ng-repeat="item in item.items" ng-include="'menuTemplate'" role="presentation" />
</ul>
<a role="menuitem" aria-haspopup="true" ng-if="item.scriptedItems.count > 0" href data-toggle="dropdown" aria-label="{{::item.label}} : {{item.scriptedItems.count}}" title="{{::item.hint}}">
<fa ng-if="::item.glyph" name="{{::item.glyph}}"></fa>
<span ng-bind-html="::item.label"></span>
<span ng-if="::!item.scriptedItems.omitBadge" class="label label-as-badge label-primary sp-navbar-badge-count">{{item.scriptedItems.count}}</span>
</a>
<sp-dropdown-tree role="menu" aria-label="{{::item.label}}" ng-if="item.scriptedItems.count > 0" items="item.scriptedItems.items" />

 

Regards,

Alok sahu

Did you create the custom field as mentioned in the first point of the solution?

Hi Alberto,

Yes i have created the custom field (true/false) in menu item form.