Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
The triggerDataSource() function eliminates the need for manually executing a Data Source from the UI.
It programmatically triggers the import of a predefined Data Source record and loads the associated data into an Import Set table.
This function is typically used in:
* Scheduled Script Executions
* Flow Designer Actions.
14 changes: 14 additions & 0 deletions Integration/Import Sets/Import sets overview/TriggerDataSource.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
triggerDataSource: function() {

var dataSourceSysId = gs.getProperty('ds.tag.based.sys.id'); //Store the sysId of DataSource from system property

var grDataSource = new GlideRecord('sys_data_source');
if (grDataSource.get(dataSourceSysId)) {
var loader = new GlideImportSetLoader(); //OOB Method to load
var importSetRec = loader.getImportSetGr(grDataSource);
var ranload = loader.loadImportSetTable(importSetRec, grDataSource);
importSetRec.state = "loaded";
importSetRec.update();
return importSetRec.getUniqueValue();
}
},
Loading