Is there any way to run transform map automatically?

Kapil20
Tera Contributor

My requirement is, if i submit a request using one of the service catalog with the attachment excel file which needs to be upload into service now. After i submit a request with excel file it should trigger a particular transform map.

Thanks For the help.

7 REPLIES 7

Alberto Consonn
ServiceNow Employee
ServiceNow Employee

Hi,

The Transform map will automatically run when the data is inserted into the Import Set Table.

Please refer the below link for info - Auto run a transform map

If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.

Thank you

Cheers
Alberto

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Kapil,

Yes this is possible and 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 workflow

4) in the workflow of RITM copy the attachment from RITM to the data source using GlideSysAttachment

GlideSysAttachment.copy('sc_req_item', current.sys_id, 'sys_data_source', '<dataSourceSysId>');

5) use below script in your workflow script 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 mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Ankur Bawiskar 

You really made my day!!!! Thank you so much. Each step explained very clearly. I simply followed your instructions and finished my requirement in just 30 mins.

Hi @Ankur Bawiskar ,

 

In the above scenario there will be multiple attachments to the same Data source and not the latest attached will be loaded. Only if we delete the existing attachment on the data source and attach a new one then it picks the new attachment