# Magic ID

Using the Magic ID lookup relationships, Dataimporter can automatically perform a VLOOKUP on your behalf, to link related records from the source org, to the newly created records in the Target Org.

Let's run through the same example from the [Previous document](/migration-templates/setting-up-the-template.md) using the Contact object.

Under the Account lookup you will see that the mapping has been completed automatically for you, with the AccountId from the source org being mapped to the Account Lookup via MagicId in the Target Org.

<figure><img src="/files/1bnrag0m86BK9l6bE1Qg" alt=""><figcaption></figcaption></figure>

What Dataimporter will do in the background, is take the source and target Ids of the parent records that were created, and perform a match, so that when the Lookup values are populated in the target org, they are the same records which existed in the source org.

**MagicId can only be used to link objects which are included in the Migration Template, and the referenced object must be run before the current object.**

If you try to include an object as a MagicId which is either not included in the Template, or is set to run after the current Job you will receive an error.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.dataimporter.io/migration-templates/magic-id.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
