Tuesday, August 20, 2019

Weird Internal Server Error on Publishing Extension

I am working on a AL project which is on NAV 2018, and I have run into the below error several times now

image

This happens when I publish my extension from VS Code using F5, the packing is created successfully but it fails to publish with the above error message, sometimes the error message is very vague like Internal Error occured…..

I am not sure if it has to do with this specific version of cumulative update or NAV 2018, but below are the steps I took to resolve the issue

  • 1.  If you have a web client/Win client open or even powershell command prompt from the container then close all of those and try again.  This trick did work sometimes but not always.
  • 2.  Restart the docker container using VS Code Docker Extension or using command prompt
  •      docker restart <containerid>

I believe running Sync-NAVTenant may resolve it but I could not launch the powershell, it just closes abruptly and nothing in the docker logs about the error message

 

 

Share:

Friday, August 9, 2019

How to handle changes in NAV/BC when event does not exist ?

questions-4304981_1920

In the NAV2018/BC we are using AL for development and build extensions for our customizations using table/page extensions and events.  But in NAV 2018  and also in BC on premise versions there are certain cases where we don’t find the event to subscribe, in that case how should we handle the modification ? and avoid any conflicts in the next upgrade.

In those scenarios, should we modify the base objects like the old way ?

Sometimes events even get trickier. Such as I want to exit from a calling function without executing the next line of code, after the event is executed ? This is not possible unless you design the event in that way. In this case, the event should have a variable as parameter, which we set in the subscriber function based on our condition, and if that is true, in the calling function there is already a code added to check that value and exit. Everyone has a unique requirement, so designing events this way is little harder. I think in the future the events may evolve where we will have a way to define that. Anyhow, I ran into this kind of situations only couple of times.

The real question is how we handle the modification when there is no event available to subscribe. This is the procedure I am following and sure there are better ways to handle it. I usually check if the same object in the newest cumulative update or in the new version, if there is any event added, then I try to copy that and update the object in our version, that way it will not create any conflict during the upgrade.

For example, I have a created a new field on the Ship-to Address and Sales Header table called “Locality”, so when a ship-to code is selected, I want to transfer the Locality value from the respective Ship-to Address table to Sales Header. In NAV 2018 version CU 14, I don’t have any events available to subscribe to transfer the value, but in the newest version I found this event “OnAfterCopyShipToCustomerAddressFieldsFromShipToAddr”

 

image

I have just copied over that event from the new version to my version. Then in my extension, I have created a subscriber Codeunit and subscribed to the function. 

If I don’t find a event, then I will create my own event, and try to name it properly, following the standards MS is using that way in future version if they add anything it may reflect. Also suggest/ask the product team in the below link

https://experience.dynamics.com

Share:

Thursday, August 8, 2019

Cannot import the data because the table with the ID ….

Few weeks ago, I was trying to import a company from a Test database to Development database. I have exported the data from the test database using the Export to Data File option which creates a .navdata file and if the both databases have the same schema you can import that file into another database.

You can read more about How to Export/Import Data from the below link
https://docs.microsoft.com/en-us/dynamics-nav/exporting-and-importing-companies-and-other-data

In my case, both databases have the same schema, but when I try to use the Import Data, I got the below error
Cannot import the data because the table with the ID 27 in the specified file has different fields or key definitions than the application database. Make sure that you are importing data into the same application as it was exported from

I have check the Table 27 in both databases and they have the same schema, but I still get the same error. I have compiled the objects, and restarted the NAV Service just to confirm the schema is in sync but that did not resolve the issue.



The issue was I have a extension (“Sales and Inventory Forecast”) installed in Test Database but not in the other database, so I have uninstalled the extension from the Test database and re-exported the data. This time the import ran without any error.

So, when you use Export/Import Data option, make sure you check the same extensions are installed in both the databases.
Share:

Released Cumulative Updates for NAV and D365BC

List of released cumulative updates for supported DynNAV and D365BC versions

Released Cumulative Updates for Microsoft Dynamics NAV 2015

support.microsoft.com/.../released-cumulative-updates-for-microsoft-dynamics-nav-2015

Released Cumulative Updates for Microsoft Dynamics NAV 2016

support.microsoft.com/.../released-cumulative-updates-for-microsoft-dynamics-nav-2016

Released Cumulative Updates for Microsoft Dynamics NAV 2017

support.microsoft.com/.../released-cumulative-updates-for-microsoft-dynamics-nav-2017

Released Cumulative Updates for Microsoft Dynamics NAV 2018

support.microsoft.com/.../released-cumulative-updates-for-microsoft-dynamics-nav-2018

Released Cumulative Updates for Microsoft Dynamics 365 Business Central Spring 2019 release (v14)

support.microsoft.com/.../released-cumulative-updates-for-microsoft-dynamics-365-business

Released Cumulative Updates for Microsoft Dynamics 365 Business Central Fall 2018 release (v13)

support.microsoft.com/.../released-cumulative-updates-for-microsoft-dynamics-365-business

Share: