Hi, How to Run a data source ?

Sachin65
Tera Expert

 How to Run a data source through schedule Job weekly basis.. 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Sachin,

Here are the steps:

1) create a data source with some file as attachment xls, csv etc

2) create transform map, field maps etc as usual

3) create a schedule data import and attach this data source to this data import. keep it active false since you will be triggering it from schedule job

4) use below script in your schedule job to execute the data source

var schImp_GR = new GlideRecord('scheduled_import_set');
schImp_GR.addQuery('name','<NameOfDataImport>');
schImp_GR.query();
if(schImp_GR.next()){
SncTriggerSynchronizer.executeNow(schImp_GR); // this will work in global scope

//gs.executeNow(schImp_GR); // this will work in scoped app

}

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

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Sachin,

Here are the steps:

1) create a data source with some file as attachment xls, csv etc

2) create transform map, field maps etc as usual

3) create a schedule data import and attach this data source to this data import. keep it active false since you will be triggering it from schedule job

4) use below script in your schedule job to execute the data source

var schImp_GR = new GlideRecord('scheduled_import_set');
schImp_GR.addQuery('name','<NameOfDataImport>');
schImp_GR.query();
if(schImp_GR.next()){
SncTriggerSynchronizer.executeNow(schImp_GR); // this will work in global scope

//gs.executeNow(schImp_GR); // this will work in scoped app

}

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

 

Hi Ankur Bawiskar   Its Working, thanks you....

 
 
2018 MVP
2017 Leader (July)
Certified Implementation Specialist
28,585 points - Community Level 7