Method as a parameter (in D365FO)

We usually have methods where the logic is written in code and it just receives some data in parameters. But sometimes it’s benefitial to allow the caller code to define a piece of logic by itself. For example, I can write code to filter a collection and let consumers decide what condition should be used …

Continue reading ‘Method as a parameter (in D365FO)’ »

Animated GIF thumbnails from a video

This blog post isn’t about Dynamics AX / Dynamics 365, although it may occasionally be useful for some AX/D365 developers as well. Let’s say I have a 30 minutes long movie that I want to share on a website and I want to give people an idea about the content of the video. Therefore I …

Continue reading ‘Animated GIF thumbnails from a video’ »

Calling async method from X++

There is a trend in the .NET world to make time-consuming calls asynchronous, to prevent applications from getting blocked when waiting for a response from a web service and things like that. Many existing APIs were enhanced with asynchronous variants of previously synchronous actions and some newer APIs offer only asynchronous methods. So… how can …

Continue reading ‘Calling async method from X++’ »

Discovery of JSON-based custom services in AX 7

If you download AX integration samples from GitHub, you’ll see (in JsonConsoleApplication project) that you can call JSON-based custom services by code like this: var request = HttpWebRequest.Create(ClientConfiguration.Default.UriString + "api/services/UserSessionService/AifUserSessionService/GetUserSessionInfo"); request.Headers[OAuthHelper.OAuthHeader] = OAuthHelper.GetAuthenticationHeader(); request.Method = "POST"; request.GetResponse(); It will call the operation and return its return value as JSON: { "$id":"1", "AOSLocaleName":"en-US", "AXLanguage":"EN-US", "Company":"DAT", "CompanyTimeZone":58, …

Continue reading ‘Discovery of JSON-based custom services in AX 7’ »

Catching exceptions in AX 7

In this blog post, I briefly recapitulate how to throw and catch exceptions in X++ and introduce a new way of handling CLR exceptions in AX 7. X++ exceptions When you want to throw an exception in X++, you typically do it by something like this: throw error("It’s broken!"); It’s a functional equivalent of adding a …

Continue reading ‘Catching exceptions in AX 7’ »