Generate a file in Orchestration, put on MID server

natep
Kilo Contributor

I generate a formatted file from a script in Orchestration and need to put it on the MID server. 

We are attempting to create a file from our ServiceNow instance using attributes from an Incident which will trigger the workflow, placing the generated file in the filesystem of the MID Server. We'd like to to then take that file and FTP to a different internal system.

I'm sure I'm missing something obvious. Any thoughts on how to accomplish this? 

6 REPLIES 6

tim_broberg
ServiceNow Employee
ServiceNow Employee

No, you're not missing something obvious.

There are some less obvious options that may work for you.

Approach #1, awesome power, but internal interfaces:

Orchestration has activities to SFTP files between targets, but not from the instance.

Integrations has facilities to export records to the mid, which puts the records in an attachment and then sends the attachment to the mid.

Both of these use the same internal mechanism which allows transfer between sources and sinks in {ftp, sftp, scp, attachments, mid server file}, but there is no easy javascript API or activity to put that functionality within easy reach.

If you run the above and look at the ecc_queue, you should be able to work out what that internal API is, but it is currently an internal API.

You might make a feature request for it? I've added it to my list of possible hackathon projects to provide easy access to that.

So, what can be done that doesn't depend on internals?

I feel like you're going to wind up base64 encoding the thing, possibly after compressing it, then somehow routing it to the target system and expanding it there.

#2, undocumented interfaces but with examples in existing mid server script includes:

Maybe a javascript probe with a mid server script include that extends SSHTerminalCommand, uses RemoteGlideRecord to grab your attachment, encodes it for transmission with base64 (preceded by gzip?) then cats the contents of your compressed base64 file to decoders on the target.

#3, just muddle through:

Or do the encoding on the instance and stick it in a probe that reproduces the contents on the target. The name field of a probe is allowed to be quite large. Script arguments can be larger.

Hope this inspires some thought that helps you break through, but if not, we can talk about it,

    - Tim.

Mike Patel
Tera Sage

Can you use Export sets to export data to Mid server ?

https://docs.servicenow.com/bundle/london-platform-administration/page/administer/export-sets/concept/c_ExportSets.html

natep
Kilo Contributor

Thank you Tim for the ideas. Wow. Was not expecting to need to do anything drastic. 

 

Mike, Thanks for the response. Export sets/scheduled export I do not think will work because the file needs to be generated at the time of trigger and has to use attributes from the Incident to create the file, which also needs to be in a specific format. 

tim_broberg
ServiceNow Employee
ServiceNow Employee

I will pass your situation and reaction along. Thanks.

    - Tim.