Service Portal: list - open record in new tab

Adil JEBLI
Mega Expert

Hi everyone,

Do you have any idea how I can open a record from a list in new tab by changing the "data table from instance definition"?

I want to make the same behaviour as "target = _blank" in the HTML, but the widget doesn't use a "<a>" tag, it uses the go method in the scope.

NB: the standard redirect to the form of the record in the same tab.

Thank you.

1 ACCEPTED SOLUTION

Adil JEBLI
Mega Expert

Hi This is the solution when you have something like this :


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


var parms = {};


parms.table = table;


parms.sys_id = item.sys_id;


parms.record = item;


$scope.ignoreLocationChange = true;


for (var x in c.data.list) {


c.data.list[x].selected = false;


}


item.selected = true;


$scope.$emit(eventNames.click, parms);


};



replace $emit by windows.open




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


var parms = {};


parms.table = table;


parms.sys_id = item.sys_id;


parms.record = item;


$scope.ignoreLocationChange = true;


for (var x in c.data.list) {


c.data.list[x].selected = false;


}


item.selected = true;


window.open( "/spdig?id=directig_consult&table="+parms.table+"&sys_id="+ parms.sys_id,"_blank");



};


View solution in original post

5 REPLIES 5

kristian dimitr
Tera Guru

Hi Adil



You can use something similar, construct your url:


url = '?id=' + item.page + '&sys_id=' + ciHardware + '&product=' + item.sys_id;


and then with target navigate to this url.



Kristian!


Hi Kristian
it is not possible like this , because the go default method




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


var parms = {};


parms.table = table;


parms.sys_id = item.sys_id;


parms.record = item;


$scope.ignoreLocationChange = true;


for (var x in c.data.list) {


c.data.list[x].selected = false;


}


item.selected = true;


$scope.$emit(eventNames.click, parms);


};




Thank you


Raju Koyagura
Tera Guru

I don't think it is possible through instance options however we achieved the same using client script



$scope.getSummary = function () {


window.open("url");


}


Hi Raju
thank you for the answer




Im using standard issues and this is the code :



HTML



<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>




Client Script




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


var parms = {};


parms.table = table;


parms.sys_id = item.sys_id;


parms.record = item;


$scope.ignoreLocationChange = true;


for (var x in c.data.list) {


c.data.list[x].selected = false;


}


item.selected = true;


$scope.$emit(eventNames.click, parms);


};




So as you can see i'm not using open



Have you any other idea, i want to do that without changing the logic of the code, is there a way to modify the go method ?