Pre-import scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2019 06:15 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2019 07:50 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2019 10:10 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2019 11:32 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2019 12:41 AM
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.