Auto-import attached file on RITM using workflow script

dianemiro
Kilo Sage

Hello Everyone,

Does anyone here already done an auto-import from an attached excel file on RITM using workflow script? We are trying to build a Service Catalog Item to automatically add/update/remove locations by auto-importing user's attached excel file. Reason why we want to use RITM so that Data Management team can verify if the data on the attached file is correctly filled out. After closing the catalog task, we want to run the script to auto-import the attached excel file. Thank you in advance.

Diane.

1 ACCEPTED SOLUTION

Hi Diane,

So this is what might be happening; by the time the attachment is getting copied the code to trigger the transform map might be triggering

so either do these

1) copy the attachment in workflow run script first then wait then use run script to trigger

2) or else create after insert business rule on sys_attachment table and condition as table_sys_id is your data source sys id

have the code to trigger the transform map in that BR

var dataSourceSysId = '266fc888dbb9770013c7757a8c961954';
var schedImp = new GlideRecord('scheduled_import_set');
schedImp.addQuery('data_source',dataSourceSysId);
schedImp.query();

if(schedImp.next()){
    gs.executeNow(schedImp);
}

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

View solution in original post

11 REPLIES 11

Hi,

So you are loading the catalog tasks via attachment; they must be belonging to some RITMs. Are you not having that in the file

Regards
Ankur

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

No. We dont have tasks in excel. 

 

We have some user data and we have to create catalog tasks under a RITM(workflow is running) by mapping excel records.

 

User submits Request by attaching an excel sheet which contains user data. based on number of rows I am creating catalog tasks. I created a data source, scheduled import, transform map and able to create catalog task also. But my question is I just need these tasks to be under same RITM where we are calling the transform map from workflow.

 

This is for mass prolongation form we want multiple tasks for our team based on users selected.

 

Mounika