Document Attachment on Custom Functionality in Business Central #msdyn365BC

Hi Readers,

While working on one of my projects I got a requirement to add Document Attachment base functionality to extension pages.

Let us understand this in detail. The customer was having an extended functionality in Business Central 14, Document Attachment was required to be added in custom Functionality so that the user could store attachments on Custom Functionality.

To achieve this I followed the below-mentioned steps.

Note: This has been achieved in C/AL version, for AL the Logic remains the same.

I have added Part Page in the List Page and Card Page namee “Attached Document” as shown in below screenshot

SubPageLink is set to the Custom Table 50016 and No. is the primary key.

Once you have added this Part page we can see the Attachments on the list page as shown in the below screenshot.

Lets try to test it by adding a Document to the Attachment, so click on the DrillDown of the count and new page will open. Select file and add as shown in below screenshot.

The file is attached in the database , but when we check the Document Count in the part page it is not updated as shown in below screen shot.

To identify the same , we need to Zoom the page and check the Primary Key of the Record . The No. which is getting updated in the record is Blank i.e. The records are inserted in the Table but it is not linked with correct record set.

To achieve this we need to add a subscriber codeunit which will extend the base functionality.

Add 1st Subscriber as shown in below screenshot for OnBeforeDrillDown.

Add below mentioned code to pass the RecordRef.

Add variable in the subscriber for RecorRef.

add 2nd Subscriber as shown in below screenshot for onAfterOpenForRecRef.

Add below mentioned code to pass the RecordRef.

Note: The Field ID for PrimaryKeyFieldID in RecRef.Field(PrimaryKeyFieldID) for my custom table is 3.

Add the Variables as shown below.

We have completed the development part, now lets test the functionality.

When you try to add the attachment now, it will update the Document count as well.

To understand AL Development kindly ref: Customer Requirement for AL Development.

To get new updates and learn about Microsoft Dynamics 365 Business Central Microsoft Learn and Self Learning

Divyesh Chitte

Connect  – Twitter | Facebook | Linkedin 
Follow    – Blog | Facebook Page  | DynamicsCommunity

Dynamics 365 Business Central Launch Event #msdyn365bc

Hi Readers,

Dont miss the opportunity to join Business Central Community #MSDyn365BCLaunchEvent and connect with experts.
Get Ready for yet another virtual launch of business central Wave 1 2021 and it is streamed on 13th April 2021

This will a free virtual event for everyone from reselling partners, consultants, and ISV partners

If you have not registered for Dynamics 365 Business Central Launch Event Register now at https://events1.social27.com/msdyn365bclaunchevent2021w1/auth/register

Tuesday, April 13, 2021 | 8:00 – 9:30am Pacific Time (UTC -7)

Connect with product experts and access 10+ hours of live and on-demand content to uncover the latest product updates.

This session covers.

  • Deliver seamless service and performance
  • Improve compliance and security
  • Build ISV solutions and support globalization
  • Delight customers by exceeding expectations
  • Drive better together Microsoft experiences

Divyesh Chitte

Connect  – Twitter | Facebook | Linkedin 
Follow    – Blog | Facebook Page  | DynamicsCommunity

How to Generate runtime app for Business Central On Prem #MSDYN365BC

Hi Reader,

I was trying to publish an app in Business Central on prem , so I tried generating run time app in MSDYN365BC.

Lets understand the process of building the Runtimeapp in Business Central

Syntax Get-NAVAppRuntimePackage

Use the Get-NAVAppRuntimePackage cmdlet to get a NAV App runtime package.

Get-NAVAppRuntimePackage -ServerInstance BC170 -Name ‘APPName’ -Version 1.0.0.2 -Path ‘AppName _1_0_0_2_runtime.app’


RUN Business Central Admin Shell as Administrator

Get-NAVAppRuntimePackage -ServerInstance BC170 -Name ‘MyExtensionAPP’ -Version 1.0.0.0 -Path ‘MyExtensionAPP_1_0_0_0_runtime.app’

Once this command is run in Business Central Admin Shell as Administrator the Runtime app file is generated in
C:\Windows\System32

Once this Runtime app is you can install ,sync and publish the app in Business Central On Prem version

Step 1
Publish-NAVApp -ServerInstance BC170 -Path ‘C:\MyExtensionAPP_1_0_0_0_runtime .app’
*Change the path and Service instance

Step 2
Sync-NAVApp -ServerInstance BC170 -Name ‘ MyExtensionAPP ‘ -Version 1.0.0.0 -Tenant default
*Change the Service instance

Step 3
Install-NAVApp -ServerInstance BC170 -Name ‘ MyExtensionAPP ‘ -Version 1.0.0.0
*Change the Service instance

NOTE

You generate runtime packages for distribution of extensions that do not contain AL code, but only the final artifacts used by the server at runtime. Runtime packages allow you to protect the intellectual property represented by your AL source code. The extension in a runtime package can be installed on servers that do not have a developer license. The license is checked on the server where the runtime package is generated.

To get new updates and learn about Microsoft Dynamics 365 Business Central  Microsoft Learn and Self Learning

Happy Reading.

Divyesh Chitte

Connect  – Twitter | Facebook | Linkedin 
Follow    – Blog | Facebook Page  | DynamicsCommunity

Dec 2020 Cumulative Updates for Microsoft Dynamics NAV

Hi Readers,

Below are the Cumulative updates Download links for Microsoft Dynamics NAV #MSDYNNAV

Business Central Cumulative Updates

Released Cumulative Updates for Microsoft Dynamics NAV 2018

DownloadCumulative Update 36 for Microsoft Dynamics NAV 2018 (Build 45821)
Release dateDecember, 2020
Build no.Application Build 45821
Local versions includedAT, AU, BE, CH, CZ, DE, DK, ES, FI, FR, IS, IT, NA, NL, NO, NZ, RU, SE, UK

Released Cumulative Updates for Microsoft Dynamics NAV 2017

DownloadCumulative Update 49 for Microsoft Dynamics NAV 2017
Release dateDecember, 2020
Build no.Application Build 30392
Local versions includedAT, AU, BE, CH, CZ, DE, DK, ES, FI, FR, IS, IT, NA, NL, NO, NZ, RU, SE, UK

Released Cumulative Updates for Microsoft Dynamics NAV 2016

DownloadCumulative Update 62 for Microsoft Dynamics NAV 2016 (Build 52006)
Release dateDecember, 2020
Build no.Application Build 52006
Local versions includedAT, AU, BE, CH, CZ, DE, DK, ES, FI, FR, IS, IT, IN, NA, NL, NO, NZ, RU, SE, UK

Divyesh Chitte

Connect  – Twitter | Facebook | Linkedin 
Follow    – Blog | Facebook Page  | DynamicsCommunity

Error: The Type ‘5056’ was not defined for the Function in MsdynNAV

Hi Reader,

I was trying to Export some of the Object in NAV 2017 CU13 for Merging process I encountered the below mentioned error.

How to Resolve this?

This Error Can be resolved by

  1. Open the data base in Latest Cumulative update exe.
  2. Create a new object only database in latest Cumulative update for the specific version. Like I created an object only database in NAV 2017 CU37 and it got resolved. (as I was doing intermediate merge for Upgrade)

Reason for getting this error.

Post-GDPR objects are not compatible with Pre-GDPR NAV CUs.

To get new updates and learn about Microsoft Dynamics 365 Business Central  Microsoft Learn and Self Learning

Download Link for different version of NAV and Business Central

Happy Reading.

Divyesh Chitte

Connect  – Twitter | Facebook | Linkedin 
Follow    – Blog | Facebook Page  | DynamicsCommunity

An implicit conversion is being performed from a value of type ‘Enum to a value of type Integer (AL0603) #msdyn365bc 2020 Wave 2

Hi Reader,

I was trying to upgrade my extension from msdyn365bc 2019 Wave 1 to msdyn365bc 2020 Wave 2. I came across the error where I was trying to pass Option Data Type which has now changed to Enum

There were two Scenarios in this error.

1. Error related to passing Enum field in Function

An implicit conversion is being performed from a value of type ‘Enum “Sales Document Type”‘ to a value of type ‘Integer’. This conversion can lead to unexpected runtime issues. This warning will become an error in a future release..AL(AL0603)

In the above error I was passing SalesLine.”Document Type” to default function

Solution (AL0603)

So to pass option string as Enum we need to add AsInteger like

SalesLine.”Document Type”.AsInteger()

I have mentioned it in below screen shot as well.

This will resolve the issue and you can compile the extension without warning.

I will explain second scenario in my next blog.

To get new updates and learn about Microsoft Dynamics 365 Business Central  Microsoft Learn and Self Learning

Download Link for different version of NAV and Business Central

Happy Reading.

Divyesh Chitte

Connect  – Twitter | Facebook | Linkedin 
Follow    – Blog | Facebook Page  | DynamicsCommunity