fix the UI action script
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2024 11:07 PM
Hi,
I have a UI action which is as below. I need to fix the script to run properly so that when doc number is filled for records it should download. It is a client UI action on downloadselectedrecords
function downloadSelectedRecords() {
var ajax1 = new GlideAjax('x_amspi_invog.ValidateDocNumberandDate');
ajax1.addParam('sysparm_name', 'getRecords');
ajax1.addParam('sysparm_query', g_list.getChecked().toString()); // Set parameter with sys_ids
ajax1.getXML(process);
function process(response) {
var rec = response.responseXML.documentElement.getAttribute("answer");
if (rec.length > 2) {
alert('Please be informed that the template can not be downloaded for the records without Document number and Document date');
g_list.refresh();
}
else{
alert("Doc is filled");
// this piece of code I have to exceute
var checked = g_list.getChecked(); // get's the sys_id of the checked records
var query = "sys_idIN" + checked.toString();
var rows = checked.split(",").length; // rows to be sent to the export function
var view = "x_amspi_invog_ewaybilltemplate_bulkupload"; // set this to DB view
if (rows <= 50) {
var dialog = new GwtPollDialog('x_amspi_invog_ewaybilltemplate_bulkupload', query, rows, view, 'unload_excel_xlsx');
dialog.execute();
} else if (rows > 50) {
alert('Please be Informed that Number of records selected can not be more than 50');
g_list.refresh();
}
}
}
// var sysId = '81aa16bb8707021006897446dabb35a9'; // give the sys_id of the attachment record
// var url = '/sys_attachment.do?sys_id=' + sysId;
// g_navigation.openPopup(url);
}
Please help me fix the script
0 REPLIES 0