On the message record mapping, define for each target document record the mapped source document record.


Standard procedure

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 FO. The relation is set after the D365 FO record is inserted or updated.
  Select Yes in the External reference field.
8. Define what must be done to the target record on import to D365 FO.
Existing records are found based on the key fields as defined in the field mapping.
You can choose from these record actions:
- 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: This option is not used often because it is often not allowed to delete data in an ERP application.
- Replace: If the record exists, it is first deleted and then inserted again based on the source data. You can, for example, use this for updated orders, if you do not know which lines are deleted.
- Find: Only finds the record, which can be used as source record in a field mapping of a next 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, is fails.
  In the Record action field, select an option.
 

Note: You can also use this to export to an external database. So, the target document is of type ODBC. In this case, only choose from these record actions:
- Update or insert
- Insert
- Delete

9. You can indicate if a condition must be met to apply the record mapping. You can also indicate what type of condition is used.
You can choose:
- 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.
  In the Condition field, select an option.
10. Define when the mapping is executed for a source record:
- 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.
- 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, to each sales order in the source document, one cost sales line is added.
  In the Execute field, select an option.
11. Close the page.

Provide feedback