
tiagomacul
Mega Sage
Options
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 06-24-2021 12:06 PM
Export file to a mid server
Image | Description |
| 01. Navigate to >> System Export Sets > Create Export Set |
| 02. Enter a name for this Export Set |
| 03. What to export, for an example incident |
|
04.Where to export to An Export Target details the location on a MID Server that data will be exported to.
For Standard, for example example starts with: "C:\MIDServerInstall\agent\export\"
YES, IF " NO, Select a mid server
|
|
05. Type the file path, an example "/myDirectory/MyExport/" |
06. Click Submit | |
07. How to test? after created, scroll down and click "Test export 20 records" | |
08. waitting | |
09. Click View export History | |
10. You'll see the logs | |
| 11. On the mid server the file is available |
Alternatively you can use script, like said johnstettin, on his post "click here"
/* exportToMid - Function to export a *specific* attachment to a mid servers
* export folder.
*
* Usage: exportToMid("my_file_to_export.pdf", "incident", "12345678910111213", "MIDSERVER001")
*
* @param attachment_name {string} - Specific attachment file name
* @param attached_table {string} - Table the file is attached
* @param attached_record {sys_id} - SYS_ID of the record the file is attached
* @param mid_name {string} - MID Server name
* @return {null}
*/
function exportToMid(attachment_name, attached_table, attached_record, mid_name) {
/** TODO: Add Error Control and validation **/
// Create ECC attachment record used to send the file to the mid server
var ecc_att = new GlideRecord('ecc_agent_attachment');
ecc_att.initialize();
ecc_att.name = 'Export Set Attachment';
ecc_att.short_description = 'exportToMid: ' + attachment_name;
ecc_att.insert();
// Copy attachments (OOB Function copies all attachments)
GlideSysAttachment.copy(attached_table,attached_record,'ecc_agent_attachment',ecc_att.sys_id);
// Get the SYS_ID of the exact attachment file to be exported and used in ECC Payload
var at = new GlideRecord('sys_attachment');
at.addQuery('table_name', 'ecc_agent_attachment');
at.addQuery('table_sys_id', ecc_att.sys_id);
at.addQuery('file_name', attachment_name);
at.query();
at.next();
// Create XML for ECC Payload
var xmlString = '<?xml version="1.0" encoding="UTF-8"?>' +
'<parameters>' +
'<parameter name=\"stream_relay_response_topic\" value=\"ExportSetResult\"/>' +
'<stream_relay_source attachment_sys_id=\"' + at.sys_id + '\" type=\"AttachmentSource\"/>' +
'<stream_relay_transform attachment.table_sys_id=\"' + ecc_att.sys_id + '\" order=\"0\" stream_relay_transfer_progress_interval=\"150\" type=\"AttachmentProgressTransformer\"/>' +
'<stream_relay_sink path="\/' + attachment_name + '\" type=\"FileSink\"/>' +
'</parameters>';
// Create ECC Record
var eccQueue = new GlideRecord('ecc_queue');
eccQueue.initialize();
eccQueue.agent = 'mid.server.' + mid_name;
eccQueue.topic = 'StreamPipeline';
eccQueue.queue = 'output';
eccQueue.state = 'ready';
eccQueue.payload = xmlString;
eccQueue.insert();
}
Export - Determine maximum rows to export - glide.csv.export.limit'
EXPORTING DATA WITH SYS IDS / KB0690876
- 7,156 Views