All Around Microsoft Dynamics Business Central

Extending the new Office Add-Ins of Microsoft Dynamics NAV 2017

I work at a Microsoft Dynamics NAV Partner and we use Dynamics NAV also as a ticket system and a planning tool for our tasks.
Often, I get E-Mails like: ”Hey Thomas, can you check T00010 for me?“ or „Can you check Task 000015A“.So, it would be quite nice to see the Dynamics NAV content directly in Outlook. First I analysed the XML manifest and quickly found out, that NAV generates this manifest with Codeunit 1643 “Hyperlink Manifest“. I copied this codeunit to 51643 “Hyperlink Manifest Custom“ and extended the RegEx like this:

cu51643

The RegEx “([0-9]{6}[A-Z])“ matches our task no. series and the RegEx “(T[0-9]{6})“ matches our ticket no. series.

Now we have to change the “Manifest Codeunit ID“ in the “Office Add-in Management“ page:

addinsetup

Next step: Deploy add-in!

Now I check a test E-Mail in O365 Outlook.
And it works!

mailwithhyperlink

I still had to Implement the NAV lookup logic and I found out that codeunit 1637 “Office Document Handler“ handles the call from O365. I copied the codeunit to 51637 “Office Document Handler Custom“ and created some “quick and dirty” lookup functions:

cu51637

CollectTicketMatches is equally built to CollectTaskMatches. After that we had to change the function “GetHandlerCodeunit“ in codeunit 1630 “Office Management“:

gethandlercodeunit

And a small question to Microsoft: Why is this function not implemented as an event with the handle pattern?! I had to change a standard object L
Nevertheless, NAV tickets now open via Outlook!

ticketpreview

But not the tasks. Okay, debugging time!

debugger

Why is the A at the end of my Task no. gone?
So i have to dive deeper into it. First I tried to find out there the TempOfficeAddinContext is filled.So I checked the IFrame, in chrome with developer tools, to see which url is called.

https://my-company.com/DynamicsNAV100/WebClient/auth?page=1600&filter=’Item Type‘ IS “’0“‘ and ‚Regular Expression Match‘ IS “’087554“‘ and ‚Item ID‘ IS …

Hmm still missing here. Ok we need more research. Analysing the network traffic with the developer tools shows that the first call goes to https://my-company.com/DynamicsNAV100/WebClient/OfficeAddin.aspx.In this aspx file is only a js file included:

js1

And the first function looks like the evil one. Ok right click -> usage:

js2

Aha here it is. I changed it to:

js3

And it works!

taskpreview

I hope this helps you to extend the NAV 2017 experience for your customer :-).

Summary:

  • „C:\inetpub\wwwroot\DynamicsNAV100\WebClient\js\OfficeClientAddin.js“ generates filter and redirects to Page 1600
  • Everything starts in Page 1600