AL icon indicating copy to clipboard operation
AL copied to clipboard

Unable to convert from JsonValue to DateTime filled with Javascript

Open netrri opened this issue 8 years ago • 8 comments

Similar to Issue #285

on Javascript side: // adding Date property to object var data = {};
var adate = new Date("2018-07-11T16:17:18.0000001Z"); data.DateTimeProperty = adate; Microsoft.Dynamics.NAV.InvokeExtensibilityMethod('OnDateTimeChanged', [data]);

then on al side:

            trigger OnDateTimeChanged(jObject:JsonObject)
            var
                myDateTime: DateTime;
                myJToken: JsonToken;
                myJValue: JsonValue;
                myDateTimeText: Text;
            begin
                if jObject.Get('DateTimeProperty', myJToken) then begin
                myJValue := myJToken.AsValue();
                myJValue.WriteTo(myDateTimeText);
                myDateTime := myJValue.AsDateTime();
                end;
            end;

myJValue.WriteTo(myDateTimeText) shows 2018-07-16 11_41_28-pag50300js2al al - alproject2 - visual studio code

but myJValue.AsDateTime() generates following Message:

image

  • AL Extension Version: 0.16.19969
  • Server Version: Developer Preview – June 2018 hosted by Azure Sandbox

netrri avatar Jul 16 '18 10:07 netrri

Hello, any news concerning this error? I checked it against the newest developer Preview image bcsandbox:12.3.23590.23945-us and it is still not possible to convert, throwing the same error message.

netrri avatar Sep 13 '18 14:09 netrri

Hi! Any update on this?

Example string: 2018-10-08T12:00:00Z

AL Extension Version: 2.0.43900 Server Version: BC RTM

kwettermann avatar Oct 08 '18 09:10 kwettermann

Note that this was a server issue so it's bound to not only the extension version but your server version. Thanks again for reporting the issue.

ghost avatar Nov 06 '18 11:11 ghost

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 build number 25582.

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 avatar Nov 15 '18 10:11 ALGitHubBot

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 build number 25582.

Is this info correct?

I've pulled the latest insider build and it is still not working.

Using image bcinsider.azurecr.io/bcsandbox-master:latest
NAV Version: 14.0.25906.0-W1
AL Version: al-2.0.58805

kwettermann avatar Nov 16 '18 08:11 kwettermann

Hi @kwettermann, please try again in the next coming days, we are still working on this process. The build number above is not directly (yet) correlated to the versions you see, I'm sorry for the inconvenience, we are working on it.

ghost avatar Nov 20 '18 09:11 ghost

Ah, thank you for the clarification!

kwettermann avatar Nov 20 '18 10:11 kwettermann

Is there any update on this, seems its still not working in the lasted Docker image?

rickblommetjes avatar Aug 12 '19 08:08 rickblommetjes