Reason:
- NAV and CRM can be integrated using inbuilt standard features. However, there are certain scenarios where CRM have new / customized fields. These data if required in NAV, then you’re at the right blog to see ‘How-To-Do’ this.
Who can do it?
- Knowledge of NAV Development
- Knowledge of NAV Table objects
- Basic knowledge of PowerShell commands
- Basic knowledge of CRM, its Entity and Fields
Pre-requisites:
- NAV 2016 or above
- Access to NAV Development environment and NAV developer’s license
- CRM access (credentials and connecting URL required)
Steps:
- IDENTIFICATION-
- In CRM, identify all Custom fields in Entity. (just for cross-verification later)
- These fields will be required in NAV as well.
- What in case if there is any new Entity in CRM which need to relate to NAV? (Ans: I will show steps for that too)
- Now, what do you think is required to connect this entity and field with NAV?
- Maybe same table structure in both application’s DB? (yes)
- Connectivity between NAV and CRM? (yes)
- TABLE MAPPING-
- In NAV, we can either use existing table or create new table-
- When to go for new NAV table, if-
- New Entity in CRM disconnected with NAV
- Existing Entity in CRM disconnected with NAV
- When to modify existing NAV table, if-
- Existing Entity in CRM connected with NAV
- New fields to be added in NAV
- Fields to be deleted/disabled in NAV
- When to go for new NAV table, if-
- Below are steps to create new NAV table which will relate to CRM entity-
- Very simple!! Just execute a Windows PowerShell command (with Administrator rights).
- After you import required PowerShell script of NAV, you can use ‘New-NAVCRMTable’ command.
- How this command works and parameters required to generate something? (Answer on next point)
- Consider a sample command ‘New-NAVCrmTable -Credential (Get-Credential -UserName crmnav@xyz.com -Message “Enter Password”) -CRMServer https://<CRMInstance>.<CRMServerDomain>.com/crmnav -EntityLogicalName <CRM Entity name> -ObjectId <NAV Table Object ID> -Name <NAV Table Object name> -OutputPath <File path>’
- In NAV, we can either use existing table or create new table-
Parameters | Description | Example(s) |
---|---|---|
-Credential | Specifies a credential required to connect to provided CRM Server | I’ve used ‘Get-Credential’ command of Windows PowerShell which is more secure way. |
-CRMServer | Server details of CRM. It is basically in URL format. | -CRMServer https://<CRMInstance>.<CRMServerDomain>.com/crmnavOr
-CRMServer https://<CRMInstance>.<CRMServerDomain>.com/ |
-EntityLogicalName | This is Entity name of CRM. This can be identified in step 1. d. | -EntityLogicalName quoteOr
-EntityLogicalName salesorderdetail |
-ObjectId | This is new NAV Table object ID which will be created by PowerShell. | -ObjectId 50000 |
-Name | This is new NAV Table object name which will be created by PowerShell | -Name “CRM Sales Quote”Or
-Name “XYZ Table” |
-OutputPath | This is file path where PowerShell will generate and export .txt file of NAV Table object | -OutputPath C:FilePathOr
-OutputPath D:FilePath |
- Get-Credential – This is PowerShell provided command. It is used so that developer enters the credential of CRM instead of mentioning it on command. Refer (https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/get-credential?view=powershell-5.1).
- After successful execution of PowerShell command, it generates a .txt file with ‘T’ as a prefix followed by Object id. For example, T50000.txt
- Import .txt object file in NAV and compile it
- New Table object will be created in NAV with all fields available in CRM’s entity
- This table will not run until ‘CRM Integration’ is enabled in NAV
- TABLE thing DONE 😊
- Below are steps to work on exiting NAV table which will relate to CRM entity-Below are steps to work on exiting NAV table which will relate to CRM entity-
- You need to follow all the steps in 2.b
- Beware, do not directly import or replace existing NAV table.
- Here additional work will be to merge existing NAV Table object’s text and recently created NAV Table object’s text (from step 2.b.vi.)
- This may include merging of new fields
- Merging of field properties
- Merging of new field type (rare case)
- After successful merging, you need to import merged object in NAV and compile
- This table will not run until ‘CRM Integration’ is enabled in NAV
- Pretty Easy!!
- FIELD MAPPING-
- Field mapping is only required when existing NAV Table object is modified.
- All CRM fields in Entity will be readily available in a .txt file which was generated from above steps.
- Hence, no manual work in this case.
Feel free to mail me on manish.kutar@ecanarys.com if you need any further information on this