Loading data with dependencies
This is a tip on using the Data Loader and Master Data Template, when performing master data migration.
Occasionally, there will be data which refers to other data of the same type.
For example, the Term record for Semester 2 2021, is referencing Semester 1 2021 as its previous Term.
When you load these into your instance, you will encounter an error, because Semester 2 2021 needs Semester 1 2021, but Semester 1 2021 has not been created yet at that point in time.
In other words, the error happens because you are trying to create these dependent records at the same time.
To resolve this issue, you will need to load all the Term data first, without the 'Previous Term' lookup.
Then, you can proceed to upsert these data again, but this time with the 'Previous Term' lookup populated.
Note:
This also applies to any data which has a parent data of the same type.
For example, Grade Criteria might lookup to a parent Grade Criteria, and if both child and parent records are to be created at the same time, the same error will occur.
You will need to load all the records first without any lookup to parents, then, upsert the same records again with the lookups.