--- title: "Set up record mapping" slug: "set-up-record-mapping" description: "Learn how to map source and target document records in D365 F&SCM, including record actions like update, insert, and delete for efficient data management." tags: ["Task topic"] status: "update" updated: 2026-10-05T12:03:06Z published: 2026-10-05T12:03:06Z canonical: "docs.staedean.com/set-up-record-mapping" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.staedean.com/llms.txt > Use this file to discover all available pages before exploring further. # Set up record mapping On the message record mapping, define for each target document record the mapped source document record. ### Steps 1. Click **Connectivity studio - Integration Design**. 2. On the **Message** tab, in the list, find and select the desired message. 3. Click **Edit**. 4. In the **Mapping** section, click **Add line**. 5. Select the desired record of the target document. In the **Target record** field, enter or select a value. 6. Select the record of the source document to be mapped to the target record. In the **Source record** field, enter or select a value. 7. You can use the external reference, as defined for the source document record, to create a relation between the external record and the record in D365 F&SCM. The relation is set after the D365 F&SCM record is inserted or updated. In the **External reference** field, select an option: > [!NOTE] > Note > > You can review the relations between external records and records in D365 F&SCM in the application setup. See also: [Set up applications](/data-management/docs/set-up-applications) - **Yes**: A relation is created between the external record and the record in D365 F&SCM. - **No**: No relation is created between the external record and the record in D365 F&SCM. - **Update by owner**: A relation is created between the external record and the record in D365 F&SCM. However, the record can only be updated by the company that owns it. This company is identified in the **Created by** field (**Applications** page, **External ID** section). 8. Define what must be done to the target record on import to D365 F&SCM. Existing records are found based on the key fields as defined in the field mapping. You can choose from these record actions: In the **Record action** field, select an option. > [!NOTE] > **Note** > > You can also use record mapping to export to an external database. In that case, the target document is of type **ODBC**, and you can only choose from these record actions: > > - **Update or insert** > - **Insert** > - **Delete** - **Update or insert**: If the record exists, it is updated. If the record does not exist, it is inserted. - **Delete**: If the record exists, it is deleted. > [!NOTE] > **Note** > > This option is rarely used because deleting data is often not allowed in an ERP application. - **Replace**: If the record exists, it is first deleted and then inserted again based on the source data. For example, you can use this for updated orders if you do not know which lines are deleted. - **Find**: Only finds the record. The found record can be used as the source record in a field mapping of a later record mapping. - **Insert**: Always inserts the record, whether it exists or not. - **Update**: Updates a record if it exists. If the record does not exist, it fails. - **Insert or fail**: Inserts a record. If the record already exists, it fails. 9. You can indicate whether a condition must be met to apply the record mapping. You can also indicate what type of condition is used. You can choose: In the **Condition** field, select an option. - **No**: The mapping is always applied. - **Yes**: The mapping is only applied if the conditions are met. Define the conditions on the **Mapping condition** tab. - **Expression**: The mapping is only applied if the condition, as defined in an expression, is met. Define the expression on the **Mapping condition** tab. 10. Define when the mapping is executed for a source record: In the **Execute** field, select an option. - **Always**: The mapping is always executed. For example, if you import journal lines, you need a journal header. For each journal line in the source document, a separate journal header is created to which the line is added. - **Once**: The mapping is executed only once for each message run. For example, if you import journal lines, you need a journal header. A journal header is created only once, and all journal lines in the source document are added to this journal header. - **Parent**: The mapping is executed for each parent record in the source document. For example, you import several sales orders, and you want to add a cost line to each sales order. For the cost line mapping, set **Execute** to **Parent**. As a result, one cost line is added to each sales order in the source document. 11. Close the page.