Pre-import scripts

G Balaji
Kilo Guru

Hi,

I'm developing a scoped application where I've import set table to populate data from excel sheet. 

The data in excel sheet is organized in the following fashion(Refer attachment: template)

Table structure is organized as in the attachment:table structure.

So, before creating record in the target table,  data in the received excel sheet has to transposed(or pivot).

I understand that pre-import scripts could be applied to implement this. However, I couldn't find reference for the right syntax. 

Could someone share reference or syntax  for pre-import script?

thanks.

 

4 REPLIES 4

TrevorK
Kilo Sage

Wouldn't you be better off using a transform map?

https://docs.servicenow.com/bundle/madrid-platform-administration/page/script/server-scripting/concept/c_CreatingNewTransformMaps.html

This allows for a much easier way to shape / transform the data before you import it versus writing a giant script. Much easier to read and update.

Thanks for the response.

Transform Map comes into picture after data is loaded into Import Set table. However,  my requirement is to process it before data is pushed into import set tables.

OK. I'll be honest, I know little about your requirements, but generally I think the transformation is done in the Transform Map. I think the pre import script is more for work to be done before your data is even loaded (example: querying if today is a holiday and if so cancelling the whole import before it's started).

 

However here is a link to the objects available in the pre-import script:
https://docs.servicenow.com/bundle/helsinki-platform-administration/page/administer/import-sets/reference/r_DataImportScriptingOptions.html

I'm not sure if it will give you what you need though but those are the documented objects available in the pre-import script.

Yes, my requirement is to process data before it's been loaded into import set table. Hence, I'm looking out for pre-import scripts. I came across the link you've shared. I'm looking for complete list of objects to design my solutions properly.

Thanks for the response.