- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2022 05:29 AM
Hi Priyanka,
i have used the Data table widget using macro variable. i am seeing result like below.
i am getting any table view, Please let me know if missed anything.
Or can you help me to create some custom widget to display table records and use it in catalog variable
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2022 10:52 AM
I think this is related to your "hide submit" button post (please close the thread if you have found a solution)?
https://community.servicenow.com/community?id=community_question&sys_id=aeaf6d5d1b374990c17111751a4bcbc3
I guess in this case you want to go with the custom widget solution. The Widget is down below, here is an example of how this will look like:
Name: My Incidents
Body HTML Template:
<div>
<sp-widget widget="data.widget" />
</div>
Server script:
(function() {
data.widget = $sp.getWidget('widget-data-table', {
table: 'incident',
filter: 'assigned_toDYNAMIC90d1921e5f510100a9ad2572f2b477fe' // <Assigned to> <is dynamic> <Me>
});
})();
If you want a different filter, simply go to incident.list use the filter and then right click on the breadcrumbs: "Copy query" and paste this query in the server script.
Please let us know if this solved your problem 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2022 12:09 AM
Hi
anything possible if i click the incident number details get opened up or it is redirected to native ui
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2022 12:40 AM
Add this to the Client controller:
$scope.$on('data_table.click', function (event, params) {
$location.search('id=form&table=' + params.table + '&sys_id=' + params.sys_id);
});
Make sure to $location at the first line of the Client controller:
api.controller=function($scope, $location) {
var c = this;
// ...
};
Alternatively, if you want it to be opened with a PopUp, you can use this instead of the $location.search(...) (make sure to add spUtil in the first line of the Client controller😞
$scope.$on('data_table.click', function (event, params) {
spModal.open({
widget: 'widget-form',
title: 'Incident',
footerStyle: { border: 'none', 'padding-top': 0 },
buttons: [],
widgetInput: {
table: params.table,
sys_id: params.sys_id,
view: 'sp',
isPopup: true
}
});
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2022 12:26 AM
I've used the first approach but I just wanna display the data but right now it is showing data in editable form and has save button. I don't want this ...I just want to display the contents
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2022 01:42 AM
Add this onLoad script on the incident table (you might want to clone the ootb 'sp' view btw name it e.g. 'sp_readonly' - then you have to adjust the view name in the onload and in the widgetInput parameters):
Name: Hide All
UI Type: Mobile / Service Portal
Type: onLoad
Global: false
View: sp
Script:
function onLoad() {
setTimeout(function() {
var self = this;
var angular = self.angular;
var element = angular.element('.vfd1f4ec347730200ba13a5554ee490c0');
var scope = element.scope();
scope.data.hideRelatedLists = true;
scope.disableUIActions = true;
scope.getUIActions = angular.noop;
scope.getPrimaryAction = angular.noop;
var elements = element.find('.panel-footer');
elements.hide();
});
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2022 04:39 AM
Is this a sys_id?
vfd1f4ec347730200ba13a5554ee490c0
I tried this script and it is not working