microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
737 stars 243 forks source link

[Bug] CurrFieldNo global variable is readonly and stay 0 when field is modifed from code #4152

Closed maksym-ch closed 5 years ago

maksym-ch commented 5 years ago

Hi,

We have the following problem : when field value is validated from RTC/Web client then CurrFieldNo variable contains current field no., if field value is validated from code then CurrFieldNo stays 0. C/AL [working] SomeRec.CurrFieldNo := 10; SomeRec.Validate(Quantity,1): // inside validate function if CurrFieldNo = 10 then do smth

AL[failed] SomeRec.CurrFieldNo := 10; SomeRec.Validate(Quantity,1): // inside validate function if CurrFieldNo = 10 then do smth During publishing the following error appears error CS0200: Property or indexer 'Microsoft.Dynamics.Nav.Runtime.Extensions.NavRecordExtension.CurrFieldNo' cannot be assigned to -- it is read only

The possible solution: allow to set CurrFieldNo value from AL

JesperSchulz commented 5 years ago

Thank you for your request. We are currently setting up the process around handling of issues in this new GitHub repository and you should hence expect a short delay in the processing of this request. But we will be on your case shortly!

JohanStenberg100 commented 5 years ago

Hi @maksym-ch, thanks for reporting this issue. Can you please share a zip file with an app which shows this issue? And also please list your AL version and BC version. Thanks!

maksym-ch commented 5 years ago

Hi @JohanStenberg100 , This issue should be split by 2: 1st issue CurrFieldNo stays 0 when field validate is called from AL BCInsider project, tested on build 25530 The workflow is the following:

  1. Create a test table (ID 5100 Test)
  2. Create a test page (ID 5100 Test)
  3. Create actions on page and call field validate (Validate Field 10,Validate Field 11,Validate Field 12)
  4. Create actions on page and call SetCurrFieldNo and then validate field( Validate Field 10 with SetCurrFieldNo, Validate Field 11 with SetCurrFieldNo, Validate Field 12 with SetCurrFieldNo) The testing results are the following:
    • when field is manually changed - CurrFiledNo = no. of modified field
    • when field is changed via action from point 3 then CurrFieldNo = 0
    • when field is changed via action from point 4 then CurrFieldNo = no. of modified field (CurrFieldNo is manually set before validate) issue #4152.zip

2nd issue CurrFieldno is readonly for tableextension object BCInsiderTest project, tested on build 25530

  1. Create a tableextension 50120 for table 50100 Test
  2. Try to publish : package is not published and is not installed (for naV 2018, app is published, on install the following error received, that informs that CurrFieldNo is readonly: al currfieldissue
JohanStenberg100 commented 5 years ago

@maksym-ch We have decided to only fix your second issue, since the first one is by design. If you invoke validate from the client, the `CurrFieldNo is updated, but if you invoke it from code, it isn't.

ALGitHubBot commented 5 years ago

The fix for this issue has been checked in to the master branch. It will be available in the bcinsider.azurecr.io/bcsandbox-master Docker image starting from platform build number 26102.

If you don’t have access to these images you need to become part of the Ready2Go program: aka.ms/readytogo

For more details on code branches and docker images please read: https://blogs.msdn.microsoft.com/nav/2018/05/03/al-developer-previews-multiple-releases-and-github/ https://blogs.msdn.microsoft.com/freddyk/2018/04/16/which-docker-image-is-the-right-for-you/

ALGitHubBot commented 5 years ago

The fix for this issue has been checked in to the master branch. It will be available in the bcinsider.azurecr.io/bcsandbox-master Docker image starting from platform build number 26102.

If you don’t have access to these images you need to become part of the Ready2Go program: aka.ms/readytogo

For more details on code branches and docker images please read: https://blogs.msdn.microsoft.com/nav/2018/05/03/al-developer-previews-multiple-releases-and-github/ https://blogs.msdn.microsoft.com/freddyk/2018/04/16/which-docker-image-is-the-right-for-you/

maksym-ch commented 5 years ago

Hi, @JohanStenberg100

The fix for this issue has been checked in to the master branch. It will be available in the bcinsider.azurecr.io/bcsandbox-master Docker image starting from platform build number 26102.

The mentioned bug still has not been fixed :-(

Tried on Microsoft Dynamiccs 365 Business Central Version 13.0.26413 Visual Studio Code Version 1.30.0 AL Language 2.1.73375.

During publishing I got the following warning (Package was published but needs to be installed): [2018-12-19 08:32:28.19] The request for path /BC130/dev/apps?SchemaUpdateMode=synchronize failed with code 422. Reason: c:\ProgramData\Microsoft\Microsoft Dynamics NAV\130\Server\MicrosoftDynamicsNavServer$BC130\source\TableExtension\TableExtension50100.cs(128,17) : error CS0200: Property or indexer 'Microsoft.Dynamics.Nav.Runtime.Extensions.NavRecordExtension.CurrFieldNo' cannot be assigned to -- it is read only During installation I got the following error: 8ea04f2051ddff9220d1cc21bfac84428dfe71d0c04b67b36c pimgpsh_fullsize_distr

Could please check and fix it?

Thank you in advance