How to display the list of records using UI Action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2018 12:52 AM
Hi All,
I need to create a "Form Link" UI action on Change table. It should display a list of records from Incident table with matching criteria(Change's and Incident's category and subcategory should be same ).
How can i achieve this? I tried to set the filter using UI Action but it is not working.
Thanks in advance.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2018 01:55 AM
Hi
The easies will be to open a popup displaying the records you need
var w = new GlideDialogWindow('show_list');
w.setTitle('Incidents with matching category');
w.setPreference('table', ''incident);
w.setPreference('sysparm_view', 'default');
w.setPreference('sysparm_query', "category=" + g_form.getValue('category'));
w.render();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2018 03:11 PM
Ui action : Requester for Earlier items
Table: sysapprovel_approver
Script:
var w = new GlideDialogWindow('show_list');
w.setPreference('table', 'sc_req_item');
w.setPreference('sysparm_view', 'default');
w.setPreference('sysparm_query', "request.requested_for=" + g_form.getValue('request.requested_for'));
w.render();
It is not working, can you please help me on this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2018 04:09 PM
Be more specific.
Check your browser console, are there any errors? Did you change the UI action "Client" attribute to true?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2018 11:55 PM
Hi Chaitanya,
Please create UI Action with client checkbox 'ticked' and put 'getChangeRelatedIncident();' in Onclick field and use the below code in script field on UI Action :
function getChangeRelatedIncident () {
var w = new GlideModal('show_list');
w.setTitle('Incidents with matching category');
w.setPreference('table', 'incident_list');
w.setPreference('sysparm_view', 'default');
w.setPreference('sysparm_query', "category=" + g_form.getValue('category'));
w.render();
}
Please insert the filter condition for subcategory as well, I don't have subcategory field on my change request form. The query should look something like below:
w.setPreference('sysparm_query', "category=" + g_form.getValue('category') + "^subcategory=" + g_form.getValue("subcategory"));
Please mark this solution correct, if it resolves your problem.
Thanks