Export Set pre and post Script example required.

guptashalini041
Kilo Contributor

Hi,

Can anyone help me to get Export Set pre and post Script example.

Which type of task we can achieve in pre and post script. Please share some sample code to understand.

Thanks

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Shalini,

 

In scheduled data export Pre and Post script is used for performing any steps once the file is being placed in mid server location or the process starts.

 

Example for Post Script: Consider a scenario that servicenow has placed the file in mid server location and now you want to create a zip file with same name and add this file in that zip. You can achieve this using post script.

Write mid server script include which will pick latest file from that mid server location and create zip file. you need to send javascript probe to call the mid server script include which can be done in post export script.

 

Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

5 REPLIES 5

It is possible... 😄

 

You get the export definition as input, this contains the filename. Then you need to trigger your own ECC Queue entry like a PowerShellProbe. With that you can do what you need to on the MID.

Only tricky part is if you append timestamps to your filename, this is something you wont get as input. With that you better create your powershell scripts flexible enough to find the file 🙂 Or do not use the timestamps and add them as part of your powershell piece.