Skip to main content

Posts

Data import/export Business Events

Sometime last year, I posted about using Business Events with Data Export. The code was shared on Github too.

Now, I have updated to introduce a Data Import Business event. This is helpful for a number of scenarios (specially for integration).
Long running jobs - you don’t want to constantly call Odata services to get the status of your execution jobTrigger data execution alerts for integration - you could trigger alerts based on failures.The argument here could be that you could use alert rules to fire a business event. Alerts rules are flexible but I find that I have to use Odata calls to get more information.

To use the Import Business Event, just make sure the Project category is Integration



The business event will fire when an execution history is created.


The business event looks like this. 
Recent posts

Dynamics eCommerce source control development strategy

Recently, Microsoft released their eCommerce solution. I got started by looking at how to do a bit of development locally. The guide is here https://docs.microsoft.com/en-us/dynamics365/commerce/e-commerce-extensibility/setup-dev-environment

One of the first steps to development is to clone Microsoft github repo. That's fairly easy to do.
But, the next question I had was, “how do I do my development in my own private version control and continue to pull Microsoft's latest releases?”. I don't want to manually merge folders and deal with painful files.
I am not an expert in git and still have a lot to learn. However, below is the approach we have taken and will test out over the coming weeks to see how it works for us.

Go to Azure DevOps (my choice of version control) and Import the repository.
Click on Import repository.
Give it the github URL and name.
After a minute it should show an Import Successful message.


Using git bash, clone your Azure DevOps repo by the following …

Embedded ChatBot in #MSDyn365FO Help Pane

In this post I will share some code on how to embed a Chat bot into the Help pane in #MSDyn365FO. My full code is available on GitHub. Do share any feedback.

I won’t go into detail on how to develop the Chat bot as there are a number of ways to do it.  Options available in the Microsoft world are:  Power Virtual AgentQnA Maker botAzure Bot Service bot The point is you might want to surface that bot in FinOps to help users with their queries or support requests.

Below is what it looks like. I added a field to embed the URL in the system parameters. Once you have entered the webbot url, you will see the Chatbot tab appear in the help pane.

Loop through AOT Display Menu Items #MSDyn365FO

I have been experimenting with getting Metadata information from the AOT from FinOps. There is some discussion on this forum post which helped me.
https://community.dynamics.com/365/financeandoperations/f/dynamics-365-for-finance-and-operations-forum/316468/how-to-get-aot-objects
I thought I would try to clean it up a bit to make it a bit more readable for future reference.
The X++ code below will loop through Display menu items in the AOT and print some info.
Menu Item NameMenu Item LabelModel Namepublic static void main (Args _args) { System.Type axMenuItemTypeDisplay = new Microsoft.Dynamics.AX.Metadata.MetaModel.AxMenuItemDisplay ().GetType (); System.Collections.Specialized.StringEnumerator menuItemDisplayNames = Microsoft.Dynamics.Ax.Xpp.MetadataSupport::MenuItemDisplayNames (); while (menuItemDisplayNames.moveNext ()) { str menuItemName = menuItemDisplayNames.get_current (); //Get Model Name for the display menu item var enum = Mi…

Searching in Event Viewer for #MSDyn365FO

This might seem simple but I thought I would post it anyways.
I always tell everyone to check the event viewer if there are unexplained errors or issues with the system. Recently, I was investigating random SOAP messages failing. REST services was working fine. I wasn’t getting any clear errors except that it was forcibly closed.
System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.Problem: Where do I look in Event Viewer? In most cases I could guess which folder to look in under Microsoft > Dynamics.



Solution: Create a custom view So, I decided to create my own custom view.


Tick Critical, Warning and Error.
Select the Dynamics logs only.


Repeat the error and it should stand out.

Business Events and Date format in Flow

Business Events formats Dates in the Microsoft JSON format, e.g. "EventTime": "/Date(1560839609000)/"
I wish it was in ISO8601 standard e.g. "2019-06-18T05:40Z".

Below is what I did using Flow.

First get the integer part of the string by using the replace function.
Function: int(replace(replace('/Date(1560839609000)/','/Date(',''), ')/', ''))
Output: 1560839609000

To format into date.
Function: addseconds('1970-1-1', Div(1560839609000,1000) , 'yyyy-MM-dd')
Output: 2019-06-18

To format into datetime.
Function: addseconds('1970-1-1', Div(1560839609000,1000) , 'yyyy-MM-dd hh:mm:ss')
Output: 2019-06-18 06:33:29

Using an online converter I am able to validate my output.
https://www.epochconverter.com/


After that, you can use the Date Time string to or formatDateTime function.



For the developers out there. Newtonsoft is great for working with dates and supports both formats. Have a look at this l…

Data Management Export - XML to JSON Transformation

In my last post, I wrote about event based integration using Business Events. I used JSON as my export file type. JSON is a lot easier to work with in Microsoft Flow or Azure LogicApp.
Below is how I achieved it.
Data Management framework doesn’t do JSON by default. However, it does do XML file format.
A bit of googling and trial and error. I found this XSLT code that transformed XML to JSON.
https://gist.github.com/bojanbjelic/1632534
Here is the authors blog post to give credit.
https://www.bjelic.net/2012/08/01/coding/convert-xml-to-json-using-xslt/#code
Setup Under the Data management workspace, open the Source data format form. Create new record called JSON and set the default extension to json.
File format = XMLXML Style = AttributeRoot element = Document (I left this as default)

Create a new Export and select your entity. In the Source data format, select JSON record that was created in the previous step.

Now click on the View map icon.


In the mapping form, click on the Transfo…