Skip to main content

Posts

Showing posts from July, 2019

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 supp

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 = XML XML Style = Attribute Root 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