- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2017 10:28 PM
Greetings,
Is it possible to export data to MID server from script? It's possible with export sets, but I would like to create a form to our Service Portal and on submit save the form data to a table as well as export the data to a location on our mid server.
Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2017 12:07 AM
Hi Tero,
As of now Servicenow provides that functionality through export set and you need not write any script.
To achieve your requirement:
1) Create custom table to hold the values user submits
2) Create export definition, export target, export set and scheduled export mention file name etc, csv format etc
3) Scheduled export will be active false since you will be triggering it via script
4) Have after insert business rule on your custom table to trigger the scheduled export
script below:
var gr = new GlideRecord("scheduled_data_export");
gr.addQuery("sys_id", ''); // sys_id of your scheduled export
gr.query();
if (gr.next()) {
gs.executeNow(gr); // if using in scoped app
SncTriggerSynchronizer.executeNow(gr); // if using in non-scope app i.e global
}
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
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-26-2017 10:41 PM
Hi Tero,
you want to get data from MID server or send data to mid server?
Thanks,
shanjith joy
PS: Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2017 11:20 PM
I want to export data TO mid server as I wrote in the original post.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2017 12:07 AM
Hi Tero,
As of now Servicenow provides that functionality through export set and you need not write any script.
To achieve your requirement:
1) Create custom table to hold the values user submits
2) Create export definition, export target, export set and scheduled export mention file name etc, csv format etc
3) Scheduled export will be active false since you will be triggering it via script
4) Have after insert business rule on your custom table to trigger the scheduled export
script below:
var gr = new GlideRecord("scheduled_data_export");
gr.addQuery("sys_id", ''); // sys_id of your scheduled export
gr.query();
if (gr.next()) {
gs.executeNow(gr); // if using in scoped app
SncTriggerSynchronizer.executeNow(gr); // if using in non-scope app i.e global
}
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader