- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2023 01:51 PM
Hi,
I have created a UI action(Incident) in the Problem table. When Incident button is clicked then the List of Incident table is coming up.
Now I created one more UI Action Add to Incident in the List choice.(Actions on selected rows)
The requirement is that we can select the multiple choices from the incident list and once we select the Add to Incident then in all the selected Incidents Problem number should added or autopopulate.
Please help in this.
Thanks!
Samiksha
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2023 09:10 PM
Hi @Samiksha2
Sorry for the late reply. Got your query and just now tried in my instance and it worked as you expected.
In the Add to Incident UI action use below logic:
function downloadattachment() {
var getSysId = g_form.getUniqueValue(); //will return current sys_id/ problem sys_id
var getRec = g_list.getChecked(); //will return checked record sys_id's in list view
if (getRec.length > 0) {
var ajax = new GlideAjax("global.Newglidingabc");
ajax.addParam("sysparm_name", "updatePRinINC");
ajax.addParam("sysparm_arr", getRec);
ajax.addParam("sysparm_prb", getSysId);
ajax.getXMLAnswer(callbackdata);
}
function callbackdata(response) {
var answer = response;
if (answer == "done") {
alert("Updated successfully");
GlideDialogWindow.get().destroy(); //closes the dailog window after updation
}
}
}
Script include:
updatePRinINC: function() {
var grI = new GlideRecord("incident");
grI.addQuery("sys_id", "IN", this.getParameter("sysparm_arr")); //checked list
grI.query();
while (grI.next()) {
grI.problem_id = this.getParameter("sysparm_prb"); //problem sys_id
grI.update();
}
return "done";
},
type: 'Newglidingabc'
});
(=tested)
Hope it helps.
Murthy

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2024 06:34 AM
Hi @Murthy Ch will your solution work in a use case where I have wm_order table that extends the sm_order table? I am attempting to create a problem from a work order then from the problem record I have added the UI action titled "attach work order" then I would want to have the on click (not sure if I need a condition in the "on click field in the UI Action) brings up the wm_order list view to select work orders that will be added to the problem related list.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2024 11:25 PM
Yeah. I believe it will work. Please give a try and let me know if you need any stuck anywhere. Happy to help 🙂
Murthy

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2024 10:22 AM
Will this solution work for selecting records for any table? I have a request to use this on our wm_order table which extends the sm_order table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2024 10:44 PM
I believe it should work. Please give a try and let me know if it works.
Murthy