Migration of Invoices from Microsoft Dynamics CRM to Microsoft Dynamics NAV
Consider a scenario where we want the Invoice generated in Microsoft Dynamics CRM to be saved in an ERP.
In this article, we will migrate the invoice that is generated in CRM to Dynamics NAV using TIBCO Cloud Integration as Integration Tool.
Prerequisite:
- CRM Online environment
- Dynamics NAV
- TIBCO Cloud Integration subscription
- TIBCO Cloud Integration On-Premise Agent on the server where Dynamics NAV is installed
Step 1: Login to TIBCO Cloud Integration
- Login to TIBCO Cloud Integration (https://online.scribesoft.com/) in the server where Dynamics NAV is installed
- Go to Agents and create Agent from NEW option
Install On-Premise Agent and copy the Agent key as well
After installation, you can provide the name for the agent
Step 2: Creation of Source and Target connection.
- Creating a new connection for CRM environment:
Select ‘Microsoft Dynamics CRM’ as the Type.
Provide the connection details and select ‘Cloud Agent’ for CRM Online environment as shown in screenshot below.
Fig. Connection for Dynamics CRM - Creating a connection for Dynamics NAV:
Select Microsoft Dynamics NAV as the Type.
Provide the connection details and select the On-Premise Agent which is installed on the server where Dynamics NAV is installed. Refer below screenshot for the same.
Fig. Connection for Dynamics NAV
Step 3: Creating solutions for maps
- Create a new solution.
Select the On-Premise Agent.
Create Advanced Map.Note: There will be two Advanced Maps in the solution. One for ‘Account’ entity migration from CRM to NAV and one for ‘Invoice’ entity migration from CRM to NAV. - In the Map for Account migration:
- Select source connection as the CRM connection
- In the Query block select ‘Account’ entity
- Select the target connection as the Dynamics NAV connection
- In the Create block of the target connection select ‘NAVCustomer’ entity
- In ‘Create’ block map the required fields.
Also we need to use the ‘Update’ block to update the ‘No’ field generated for a Customer in NAV to the ‘accountnumber’ field in CRM.
We use the ‘accountid’ field as the matching criteria in the update block.
Fig. TIBCO Cloud Integration Map for Account migration - In the Map for Invoice Migration:
-
- Select source connection as the CRM connection
- Select ‘Invoice’ entity in the query block
- Add invoicedetail as ‘Related entity’ in the Query block
- Select the target connection as Dynamics NAV connection
The flow for creating the Invoice and its related invoice product is as follows:
Step 1: Lookup on account entity in the source and fetch its accountnumber field (which will contain the No that we have updated in the Account migration map).
Step 2: Lookup on ‘NAVCustomer’ entity by using the accountnumber fetched in Step 1 as matching criteria and fetch its Name.
Step 3: Use ‘Create’ block to create the Invoice entity in NAV. Select ‘NAVInvoice’ entity in the create block. Map the fields required.
Step 4: Use ‘For each child’ block for fetching the products present on that particular invoice.
Step 5: Use create block in the ‘for each child’ block and select ‘NAVInvoiceSalesLines’ entity.
Step 5:Execution of maps for account and invoice entities.
-
- Account is updated in CRM.
Fig. Before execution of CRM accountFig. After execution the AccountNumber is populated with the No that is generated in NAV - Customer is created in NAV.
- Account is updated in CRM.
-
- Create an invoice with this customer in CRM and Run the Map.
An invoice is created with that customer in NAV.