Help with Exporting XML of a record and its related list
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 11:03 AM
The task at hand is to export an XML of a record and its related lists. I am implementing it for the following ITSM tables: incident, change, and problem.
After reading through many articles I've come across an OOB script include called: ExportWithRelatedLists and I know this would be the best approach.
I am trying to utilize the script include in a server side UI action, however I get this error: access denied ("java.io.FilePermission" "undefined" "write").
These are my UI Action configurations:
Any pointers to my UI Action script would be immensely helpful:
var exporter = new ExportWithRelatedLists('incident', current.sys_id);
exporter.addRelatedList('task_sla', 'task');
exporter.addRelatedList('task_ci', 'task');
exporter.addRelatedList('task_cmdb_ci_service', 'task');
exporter.addRelatedList('task_service_offering', 'task');
exporter.addRelatedList('incident', 'parent_incident');
exporter.addRelatedList('sc_request', 'parent');
exporter.addRelatedList('interaction_related_record', 'task');
exporter.setAttachments(true); // Enable attachment support if required
var attachment = new GlideSysAttachment();
//set up inputs
var rec = new GlideRecord('incident');
rec.get(current.sys_id);
var fileName = 'example.xml';
gs.info("1Testing_c_" + current.sys_id);
var response = gs.context.getResponse();
//this exportRecords is giving me the issue
exporter.exportRecords(response);
gs.info("1Testing_d_" + current.sys_id);
var contentType = 'text/xml';
//example content to see if the xml attachment works
var content = "<access>package_private</access>"
// var content = exporter.exportRecords();
var agr = attachment.write(rec, fileName, contentType, content);
gs.info('1Testing The attachment sys_id is: ' + agr);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2023 07:26 AM
Did you check any one of existing "Export" process and replicate the same way.
As per my understanding while searching , all the existing "Export" option which are OOTB available they are triggered by UI Action and process by processor but there is no option given( default ) to add new processor unless we update the create ACL on "sys_processor" table.
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2023 06:34 PM
Hi @Arnab18 ,
Just checking if you got the issue resolved.
-Thanks,
AshishKMishra
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution