How to display the list of records using UI Action

Chaitanya Chowd
Kilo Expert

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.

5 REPLIES 5

larstange
Mega Sage

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


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

Be more specific.

Check your browser console, are there any errors? Did you change the UI action "Client" attribute to true?

Mahendra RC
Mega Sage

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