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

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");



};