Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How we can make hyperlink of Request and RITM Number in a widget.

Stella5
Kilo Contributor

How we can make hyperlink of Request and RITM Number in a widget.

1 ACCEPTED SOLUTION

Upender Kumar
Mega Sage

Hi,

You can achieve this by 2 ways.

 

1. If you know fix number of columns to be displayed.

   Add a anchor and set href attribute.

 2. If you are displaying all columns the add ng-click on td and set method to redirect.

    <tr ng-repeat="item in data.list track by item.sys_id">
<td class="pointer" ng-class="{selected: item.selected}" ng-click="go(data.table, item)" ng-repeat="field in data.fields_array" data-field="{{field}}" data-th="{{data.column_labels[field]}}">{{item[field].display_value}}</td>
</tr>  

 

In Client Script 

$scope.go = function(table, item) {

$location.url('sp?id=form&table='+table+'&sys_id='+item.sys_id+'&view=ess');
};

 

Please Hit Correct, ️Helpful depending on the impact of the response

View solution in original post

2 REPLIES 2

Rahul Jain11
Kilo Guru

You could try the following in your service portal widget, add a <a>tag in your html like this

<a href="?id=ticket&sys_id="+c.data.sysID>{{c.data.numer}}</a>

where

c.data.sysID defined in server script to store the sys_id of REQ/RITM

c.data.sysID defined in service script to store the number of REQ/RITM.

 

Thanks

Upender Kumar
Mega Sage

Hi,

You can achieve this by 2 ways.

 

1. If you know fix number of columns to be displayed.

   Add a anchor and set href attribute.

 2. If you are displaying all columns the add ng-click on td and set method to redirect.

    <tr ng-repeat="item in data.list track by item.sys_id">
<td class="pointer" ng-class="{selected: item.selected}" ng-click="go(data.table, item)" ng-repeat="field in data.fields_array" data-field="{{field}}" data-th="{{data.column_labels[field]}}">{{item[field].display_value}}</td>
</tr>  

 

In Client Script 

$scope.go = function(table, item) {

$location.url('sp?id=form&table='+table+'&sys_id='+item.sys_id+'&view=ess');
};

 

Please Hit Correct, ️Helpful depending on the impact of the response