Scheduled import: How to specify the datasource dynamically?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2017 10:34 AM
According to Scheduling Data Imports - ServiceNow Wiki
I should be able to override the datasource in a scheduled data import using the "Pre script".
However, it does not use either:
data_source = "My DS Name";
or
var grDS = new GlideRecord("sys_data_source");
if (grDS.get("name","My DS Name")){
data_source = grDS;
}
if I leave the basic datasource field blank:
Unresolved data source for ScheduledImportJob |
If I populate it, it hits the wrong datasource.
Is this a bug, bad documentation.. or am I just missing something?
Thanks,
-Stephen
Fuji patch12 hotfix1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2017 08:14 AM
Worth a shot but didn't work. It executes whatever is defined in the datasource field no matter what.
I've tried:
data_source = <data source name>;
data_source = <data source sys_id>;
data_source = <datasource GR object>;
If I leave the data source field blank, and only define it in the pre-scritp, it doesn't execute the pre-script at all.
Though, I wish I could make sense of Harel's answer.. he implies he's currently doing this.
I think this has got to be a bug.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2017 09:40 AM
It's starting to feel like a bug. Perhaps time to reach out to customer support? I'll be interested to hear what they have to say.
HI Service Portal - ServiceNow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2017 07:33 PM
I opened an incident on this, worked with ServiceNow for a while on this, helping test this and that. Eventually they agreed it was a bug and opened PRB1070186. Then six days later closed the PRB without explanation. I've already worked around this so it's not the end of the world.. would like to know why it was closed though.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2017 06:44 AM
Thank you for the update Stephen. I would call and follow up to find out why the PRB was closed. It seems a bit odd that it would be closed without any reason. I didn't see any fix targets on the PRB, so I don't know why they would have closed it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2017 07:11 AM
Initially when I reached out to ask why it was closed, it was suggested that we were using the pre-script wrong. That we should be using that to alter the associated data source rather than selecting a different pre-defined data source. (Not a feasible solution IMO)
James Bailey has been trying to get answers.
He reopened my incident and created another problem record, "PRB1151140", questioning why the proposed solution was so different than the documentation.