- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2022 04:11 AM - edited 11-28-2022 05:06 AM
Hello All,
I have a cloned widge of Copy Data Instance from table "Instance with Table [sp_instance_table]" and is there a way that open in new tab could be added along with "show matching" etc
@Ankur Bawiskar @Mark Roethof @Community Alums @Mohith Devatte @Anil Lande @Jaspal Singh
Open in New tab or ctrl option from Portal list view
Please advise
Also, is there a way to change the backend/help text of the search from "Keyword Search" to something else?
I am looking for options to open any Incident record in a new window when selected from the data table cloned widget
Thanks,
DB
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2022 06:20 AM - edited 11-28-2022 06:21 AM
@DB1 Did the solution solve your problem?
So my code would have created a new button and when you click on the button it opens the record in new window
if not let me know if you need any alternative
If this solved the issue can you please mark the answer correct and close the thread so that it will be helpful for others in future?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2022 06:53 AM - edited 11-30-2022 06:54 AM
@DB1 but i can see the OOB code is this in my PDI .Did you change any code ?
just replace your widget id in the last line instead of test
(function(){
/* "use strict"; - linter issues */
// populate the 'data' object
var sp_page = $sp.getValue('sp_page');
var pageGR = new GlideRecord('sp_page');
pageGR.get(sp_page);
data.page_id = pageGR.getValue("id");
$sp.getValues(data);
if (data.field_list) {
data.fields_array = data.field_list.split(',');
} else {
data.field_list = $sp.getListColumns(data.table);
}
if (input) {
data.p = input.p;
data.o = input.o;
data.d = input.d;
data.q = input.q;
}
data.p = data.p || 1;
data.o = data.o || $sp.getValue('order_by');
data.d = data.d || $sp.getValue('order_direction');
data.page_index = (data.p - 1);
data.window_size = $sp.getValue('maximum_entries') || 10;
data.window_start = (data.page_index * data.window_size);
data.window_end = (((data.page_index + 1) * data.window_size));
data.filter = $sp.getValue("filter");
var gr = new GlideRecordSecure(data.table);
if (!gr.isValid()) {
data.invalid_table = true;
data.table_label = data.table;
return;
}
data.table_label = gr.getLabel();
options.table = data.table;
options.fields = data.field_list;
options.o=data.o;
options.d= data.d;
options.filter=data.filter;
options.window_size=data.window_size;
options.view = data.view;
options.useInstanceTitle = true; // to make sure Data Table widget uses headerTitle always
options.headerTitle = options.title;
options.show_breadcrumbs=true;
options.enable_filter=true;
data.dataTableWidget = $sp.getWidget('test', options);
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2022 02:43 AM
@DB1 Sure in the client controller i handled the redirection part in this below function at the top of your client controller script find it and replace it with below code
c.openRecord=function(id)
{
window.open("/sp?id=ticket&table="+c.data.table+"&sys_id="+id ,"_blank");
}
Hope this helps
Accept this solution if it helped you
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2022 05:04 AM
Hello @DB1 ,
No there is no way to add another Button call open in new table when you right click on it because that the OOB configuration and even if you touch the code it might cause issues in the upgrade.
But i can suggest you one solution as a workaround for this as you are saying that you have clone the OOB data table from instance definition widget i am assuming you might the cloned the inner widget too right ?
In the below screenshot you can see its the main widget (Data table from instance definition) but you can also see they are calling one more widget called (data table) highlighted below.
So if you have cloned this widget too and replaced the cloned widget ID in your main widget then i can suggest you a solution
Let me know on the same
Also yes you can change the keyword search to another word but that also depends on the above question i asked to you
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2022 05:13 AM - edited 11-28-2022 05:17 AM
function ($scope, $location, $rootScope, spUtil, $interpolate, $window) {
$scope.$on('data_table.click', function(e, parms){
var p = $scope.data.page_id || 'form';
var s = {id: p, table: parms.table, sys_id: parms.sys_id, view: 'sp'};
$location.search(s);
});
$scope.activeRecord = function(){
$scope.$broadcast("data_table.setFilter", "active=true");
}
$scope.ClosedRecord = function(){
$scope.$broadcast("data_table.setFilter", "active=false");
}
this.data.filterText = "";
this.showFilter = false;
this.onClick = function($event, item, url, action) {
$event.stopPropagation();
$event.preventDefault();
if (typeof url == "string") {
var urlExp = $interpolate(url);
url = urlExp(item);
$location.url(url);
} else if (url && typeof url == "object") {
var newURL = $location.path() + "?id=" + url.id + "&table=" + url.table + "&sys_id=" + url.sys_id + "&view=" + url.view;
$window.open(newURL,"_blank");
} else {
var evt = {};
evt.url = url;
evt.table = item.className;
evt.sys_id = item.sys_id;
evt.record = item;
evt.rectangle_id = c.options.sys_id;
evt.action = action;
// put out the selection with simple list "sl_" prefix
$location.search('sl_sys_id', evt.sys_id);
$location.search('sl_table', evt.table);
$location.search('spa', 1); // spa means "I've got this"
$rootScope.$broadcast('$sp.list.click', evt);
}
};
}
Hi Mohith,
Thanks for the reply. If I have got the question right this is the cloned widget I have which is linked to Ticket
(function(){
/* "use strict"; - linter issues */
// populate the 'data' object
var sp_page = $sp.getValue('sp_page');
var pageGR = new GlideRecord('sp_page');
pageGR.get(sp_page);
data.page_id = pageGR.id.getDisplayValue();
$sp.getValues(data);
if (data.field_list) {
data.fields_array = data.field_list.split(',');
} else {
data.field_list = $sp.getListColumns(data.table);
}
if (input) {
data.p = input.p;
data.o = input.o;
data.d = input.d;
data.q = input.q;
}
data.p = data.p || 1;
data.o = data.o || $sp.getValue('order_by');
data.d = data.d || $sp.getValue('order_direction');
data.page_index = (data.p - 1);
data.window_size = $sp.getValue('maximum_entries') || 10;
data.window_start = (data.page_index * data.window_size);
data.window_end = (((data.page_index + 1) * data.window_size));
data.filter = $sp.getValue("filter");
var gr = new GlideRecordSecure(data.table);
if (!gr.isValid()) {
data.invalid_table = true;
data.table_label = data.table;
return;
}
data.table_label = gr.getLabel();
var widgetParams = {
table: data.table,
fields: data.field_list,
o: data.o,
d: data.d,
filter: data.filter,
window_size: data.window_size,
view: 'sp',
title: options.title,
show_breadcrumbs: false, //set filter option or bread crumbs visible false.
show_keywords: true
};
data.dataTableWidget = $sp.getWidget('widget-data-table', widgetParams);
})();
What is the inner widget you are refering to? - widget-data-table? No I have not cloned this yet
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2022 05:17 AM
I have the cloned version of "
widget-data-table
" V2 now @Mohith Devatte Please help me with next steps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2022 05:27 AM
@DB1 YES YOU CAN REFER MY ABOVE ANSWER I HAVE GIVEN YOU THE CODE JUST REPLACE THE HTML AND CLIENT CONTROLLER AND TRY .
You have to replace the above code in your cloned inner widget.
I have highlighted the piece of CODE that i have added to OOB code