Order of rows imported during data import/transformation mapping from CSV or Excel

wfay
Kilo Explorer

I am curious if anyone can tell me if Service-Now data import guarantees:
1. ordering of rows will be respected
2. ordering of rows will not be respected, but generally speaking, data comes into the tables in the order it was in the data file
3. ordering of rows is totally chaotic

I can imagine all 3 scenarios being true with equal probability. I'd like to know which is true.

(Yes I can and will perform my own testing. But I've read documentation and found zero references to this, so thought I should ask. Just because my testing shows row ordering is respected in the 50-row sample that I provide does not mean it will be respected when I provide 10k rows of Production data and am annoyed when I discover it is not respected.)

THANKS

4 REPLIES 4

ssb
Tera Guru

Or... if ordering is important to you, you could add an order field to the CSV/XLS and _ensure_ that it will be ordered as you want it.

Having said that, as far as I know, the import runs through the file sequentially, so the order the rows are inserted will be the order they are read from the file. When you select the rows from the DB, again, if order is important to you, then add an ordering field; otherwise a user will potentially be able to order them however they like.

Cheers,
Scott


wfay
Kilo Explorer

We are from another issue tracking software (say JIRA) to using SNOW for software SDLC purposes.

Ultimately we do not need the order field to be retained so it can be queried as you are suggesting. But the Excel export we are being given is essentially a series of notes that we want to attach (in the correct order!) to a given enhancement or bug in our new SNOW SDLC tables. Each note has a ticketid and sequence number associated with it.

We need to ensure that we:
1. get 1 output ticket for each unique input ticketid (easy enough, coalesce field)
2. get all related comments in the right output ticket
3. maintain ordering of those related comments in the work notes field

So again, let me ask, is there any guarantee that the ordering of my rows in Excel will be respected during the import process? My testing (with ~1k rows in another table) suggest that it is respected, but I'd feel better with a guarantee of that.

Otherwise I'll just write my own script using GlideRecord and insert rows with my own "custom" code which will GUARANTEE the ordering of the comments in the output matches the input.


Right, so you keep appending the note records to the work notes field?
Personally, I'd suggest it's safer to write your own code to guarantee it, so you future proof it against upgrades of either ServiceNow and your export.

But, because the import files are treated sequentially, you're probably safe in the assumption that IF the notes are in sequence order in the import file then they'll be correctly appended to the work notes field.


wfay
Kilo Explorer

Thanks for your replies, ssb. I agree with your assessment.

Customer code which guarantees the ordering makes the most sense to me too. 🙂 It is not overly difficult to accomplish. I can still use the Data Load tool - but then instead of using a standard Transform Map, I will use my own custom code. Shouldn't be a ton more effort than setting up the TM itself as I'm very comfortable with using GlideRecord etc.