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:

Friday, March 22, 2019

You have not been granted permission to perform the current activity

Today, when I try to launch the debugger, I got the below error



I have checked my permissions in the Navision, and I have SUPER, and there is no company specified for the permission set. So I have compared my permissions with other users, and I haven’t noticed anything different on the NAV side.

Then I opened the SQL Server and checked the Access Control table; then I spotted one difference with my permission set SUPER and with another user who has the same permission set. The [App ID] column has value for my permission set, but it is to 00000000-0000-0000-0000-000000000000 for the other user.

I ran a simple UPDATE query for my [User Security ID] to set the [App ID] to 00000000-0000-0000-0000-000000000000, and that resolved my issue

If you have any other tips or suggestions, please do share them in the comments below.
Share:

Friday, January 4, 2019

Print Send To Excel do not export all columns

Few weeks ago, I ran into a strange issue and in this blog I will discuss the issue and the solution which worked for me.

I got a requirement to add the salesperson code and sell-to customer name to the salesline page, since those fields are not part of the salesline table, I have added the code on the salesline list page to retrieve the salesheader record and display those values on the page.

Everything worked well, but when we try to use the Print –> Send to Excel option those custom fields are not available on the excel.  Couple of users were able to get those fields on the excel but not all the users.

Initially I thought it could be a permission issue on the sales header table but that was not the case, even user with SUPER permission has the same issue. We have checked if the excel version is different between those users but that’s not the case, everybody is running the same version.  I have searched the Cumulative updates if there is bug or fix for that kind of error but unfortunately I have not found anything related.

I have found a standard page which uses the similar kind of logic, the page is “Customer Order Lines Status” with ID 10010 which uses the same kind logic which it displays the status from the salesheader table and I have ran into same issue with that page, all fields were exported except the salesheader fields.

Finally, I saw one difference between the users who are able to export all the fields and other, and that is the DynamicsNAV menu on the Excel, The users who have the DynamicsNAV menu are not able to export all the fields, so I went ahead and disabled the DynamicsNAV Add-on.

Voila, that resolved the issue.  I have not uninstalled just disabled it, if you uninstall nothing will export.  I am not sure what is the reason but that resolved my issue.

Here are the steps to disable the add-on

1. Open Excel, Go To File –> Options

2. Select Add-Ins and in the bottom select the Go beside Mange Add-ons

3. Uncheck the box for the Dynamics NAV and Click Ok

DisableNAVAddIn

I hope this will help others who run into the same issue.

Please leave your comments/suggestions.



Share: