can we execute data sources(import sets) from background

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2016 04:33 AM
can we execute data sources(import sets) from background ? i.e. instead creating a scheduled import and execute it from background is there any package or util which will execute data source and transform map manually?
or else does
SncTriggerSynchronizer.executeNow('scheduled import sys_id'); has capability to execute the data source without creating scheduled import ?
- Labels:
-
Scripting and Coding
-
Team Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2019 10:40 PM
Hi Michael,
I actually just needed to add one more line to the GlideRecord for the "sys_data_source" record for the "file_retrieval_method" field.
//create new record on 'sys_data_source' table
var impRec = new GlideRecord('sys_data_source');
impRec.initialize();
impRec.name = 'Add and transform Database Xcel';
impRec.file_retrieval_method = 'Attachment';
impRec.import_set_table_name = 'u_cmdb_ci_database';
impRec.format = 'Excel';
var targetSysID = impRec.insert();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2016 05:28 AM
Have a look at "DataSourceLoader" script include in your instance. I think this is what you are looking for.
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2019 03:59 PM
None of the suggestions worked in our instance. I imported records into an import set from LDAP, queried that loaded data to get the data that I wanted, then queried the target record and updated it from the import set data. It isn't the prettiest method but it worked.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2023 11:24 AM - edited 01-25-2023 11:38 AM
This worked for me:
// Trigger a Data Source import and transform
// Get the Data Source
var dataSourceGr = current;
// Load data from the Data Source into an Import Set table
var loader = new GlideImportSetLoader();
var importSetGr = loader.getImportSetGr(dataSourceGr);
loader.loadImportSetTable(importSetGr, dataSourceGr);
// Run the Transform Maps
var transformer = new GlideImportSetTransformer();
transformer.transformAllMaps(importSetGr);