- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2020 01:05 AM
Hi Community,
i have a little UI-Action, wich exports my Cases and sets them from one state to another.
As I am moving to Orlando, my UI-Action does not work anymore and I have no clue why. Can you please help out?
The Error:
The Code:
function downloadExcel(){
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
// this code you can move to script include and go GlideAjax as well
var gr = new GlideRecord('x_bhhgh_his_cases_his_cases');
gr.addQuery('sys_id', 'IN', checked);
gr.query();
while(gr.next()){
gr.state = 6;
gr.update();
}
var view = "Workspace"; // set this to default for columns present in default view for list layout
// set this to empty if you want all the columns present in the list layout including the customized ones.
var dialog = new GwtPollDialog('x_bhhgh_his_cases_his_cases', query, rows, view, 'unload_excel_xlsx');
dialog.execute();
}
Commenting out Line 6 to 11 (the part where the State gets modyfied) everthing runs properly...
Thanks a lot in advance!!!
Best Regards,
Stephan
Solved! Go to Solution.
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2020 03:12 AM
Hi Stephan,
So you should be calling like this
I have added toString() as well while sending the checked values
Please try
var ga = new GlideAjax('x_bhhgh_his_cases.updateRecords');
ga.addParam('sysparm_name', 'updateRecorWithValue');
ga.addParam('sysparm_checked', checked.toString());
ga.getXML(processResponse);
function processResponse(response) {
var result = response.responseXML.documentElement.getAttribute("answer");
}
Also did you verify row count in script include?
Try adding some logs to function
updateRecorWithValue: function(){
var checked = this.getParameter('sysparm_checked');
gs.info('sys_ids are ' + checked);
var gr = new GlideRecord('x_bhhgh_his_cases_his_cases');
gr.addQuery('sys_id', 'IN', checked);
gr.query();
gs.info('Row count is: ' + gr.getRowCount());
while(gr.next()){
gs.info('Inside while');
gr.state = 6;
gr.update();
}
},
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2020 02:58 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2020 03:12 AM
Hi Stephan,
So you should be calling like this
I have added toString() as well while sending the checked values
Please try
var ga = new GlideAjax('x_bhhgh_his_cases.updateRecords');
ga.addParam('sysparm_name', 'updateRecorWithValue');
ga.addParam('sysparm_checked', checked.toString());
ga.getXML(processResponse);
function processResponse(response) {
var result = response.responseXML.documentElement.getAttribute("answer");
}
Also did you verify row count in script include?
Try adding some logs to function
updateRecorWithValue: function(){
var checked = this.getParameter('sysparm_checked');
gs.info('sys_ids are ' + checked);
var gr = new GlideRecord('x_bhhgh_his_cases_his_cases');
gr.addQuery('sys_id', 'IN', checked);
gr.query();
gs.info('Row count is: ' + gr.getRowCount());
while(gr.next()){
gs.info('Inside while');
gr.state = 6;
gr.update();
}
},
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2020 06:01 AM
Hi Ankur,
where can i read these logs? I added them, but have no clue where to find them 😞
The added .tostring() did not work 😞
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2020 06:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2020 06:25 AM
Hi Ankur,
i did found an error, but i am still puzzeld:
"Script: updateRecords not found in scope: x_bhhgh_his_cases, and HTTP Processor class not found: com.glide.processors.xmlhttp.updateRecords: no thrown error"
Does this help you to find the answer? 🙂