AI Builder + Lobe

During the recent Arctic Cloud Developer Challenge Hackathon I was playing around with AI Builder for the first time. The scenario we were going to build on there was the detection of Good guy / Bad guy.

The idea was that the citizens would be able to take pictures of suspicious behavior. Once the picture was taken, the classification of the picture would let them know if it was safe or not.

For this exercise I would use my trusted BadBoy/GoodBoy nephew toys:)

Lobe

To start it off I downloaded a free tool called Lobe. www.lobe.ai . Microsoft acquired this tool recently, and it’s a great tool to learn more about object recognition in pictures. The really cool thing about the software is that calculations for the AI model are done on your local computer, so you don’t need to setup any Azure services to try out a model for recognition.

Another great feature is that it integrates seamlessly with Power Platform. Once you train you model with the correct data, you just export it to Power Platform!👏

The first thing you need to do is have enough pictures of the object. Just do at least 15 pictures from different angles to make it understand the object you want to detect.

Tagg all of the images with the correct tags.

Next step is to train the model. This will be done using your local PC resources. When the training is complete you can export to Power Platform.

It’s actually that simple!!! This was really surprising to me:)

Power App

Next up was the Power App the citizens were going to use for the pictures. The idea of course that everyone had this app on their phones and licensing wasn’t an issue 😂

I just added a camera control, and used a button to call a Power Automate Cloud Flow, but this is also where the tricky parts began.

An image is not just an image!!!!! 😤🤦‍♂️🤦‍♀️

How on earth anyone is supposed to understand that you need to convert a picture you take, so that you can send it to Flow, only there to convert it to something else that then would make sense???!??!

Image64 and Power Automate – What a shit show

After asking a few friends, and googling tons of different tips/trics I was able to make this line here work. I am sure there are other ways of doing this, but it’s not blatantly obvious to me.

Set(WebcamPhoto, Camera1.Photo);

Set(PictureFormat,Substitute(Substitute(JSON(WebcamPhoto,JSONFormat.IncludeBinaryData),"data:image/png;base64,",""),"""",""));

'PowerAppV2->Compose'.Run(PictureFormat);

The receiving Power Automate Cloud Flow looked like this:

I tried receiving the image as a type image, but I couldn’t figure it out. Therefore I converted it to a Base64 I believe when sending to Flow. In the Flow I again converted this to a binary representation of the image before sending it to the prediction.

The prediction on the other hand worked out really nice!! I found my model that I had imported from Lobe, and used the ouputs from the Compose 3 action (base64 to binary). I have no idea what the differences are, but I just acknowledge that this is how it has to be done.. I am sure there are other ways, but that someone will have to teach me in the future.

All in all it actually worked really well. As you can see here I added all types of outputs to learn from the data, but it was exactly as expected when taking a picture of Winnie the Poo 😊 The bear was categorized as good, and my model was working.

Why Lobe?

One can wonder why I chose to use Lobe for this, when the AI Builder has the training functionality included within the Power Platform. For my simple case it wouldn’t really matter what I chose to use, I just wanted to test out the newest tech.

When working with larger scale (numbers) of images, Lobe seems to be a lot easier for the importing/tagging/training of the model. Everything runs locally, so the speed of training and testing is a lot faster also. It’s also simple to retrain the model an upload again. This being a hackathon it was important to try new things out 😊

More about AI builder

I talked to Joe Fernandez from the AI builder team, and he pointed me to some resources that are nice to checkout regarding this topic.

https://myignite.microsoft.com/sessions/a5da5404-6a25-4428-b4d0-9aba67076a08 <- forward to 11:50 for info regarding the AI Builder

https://youtube.com/watch?v=MQQmDUCufS8 <- Lobe

GIF Custom Connector

In my last post I wrote about Adaptive Cards in Teams, but a vital factor for that adaptive card to be interesting is the content on the card. Dynamics 365 Sales Adaptive Card🚀.

One of the technical bits last time was connecting with an HTTP GET request to the API. I will be using the same information to create a custom connector so that anyone can reuse for the future 😁

Creating the Connector

Step one.. open https:///make.powerapps.com .

Step 2.. Break down the URL from the first picture like this

Step three… If you don’t really know how to do this, ask a friend!! 🙂

Step three again.. Enter the security settings. When entering the security settings and providing something more than blank, you will be prompted with the credentials first time you create a connection to the connector.

I broke the URL down further with the “api_key” as a query, so that it would show in the URL like the example on the first picture.

Step four.. Create a search tag like the one I had in the URL from the first picture

Step five.. Get the URL from the first picture with your API key, and add this to the import sample

Choose the GET in this case, and add the full URL

Your request should look something like this:

Step 6.. Add a connection to the connector and test with a tag. It should return some info like this:

Result

When you are done, you have a custom connector you can reuse from Power Apps, Flow or any other tool that can use custom connectors.

Connector Gallery 🌌

What better thing to do than release this to the https://connector.gallery when you are done creating a new connector?? :😁💪🥇

Dynamics / Dataverse Environment Variables in Power Automate

There have been several posts on the environment variables, but I think Microsoft just released a pretty GREAT update recently. I honestly don’t have a clue when this function was released, but it made my day a LOT easier:) This is how we used to refer to Environmental Variables:

Using Environment Variables in Dynamics 365 CRM – Part 1 | Microsoft Dynamics 365 CRM Tips and Tricks (inogic.com)

Using Environment Variables in Dynamics 365 CRM – Part 2 | Microsoft Dynamics 365 CRM Tips and Tricks (inogic.com)

Basics

When moving solutions from system A to system B we often have hardcoded values in workflows/flows/javascripts etc. These cause problems because the fields often have different values in each environment.

Sure you can migrate variables/records between systems and be sure to never overwrite, but it can be time consuming to maintain.

Microsoft has introduced environmental variables to Dynamics / Dataverse to fix this exact problem. You create a new Environmental variable in your solution, and you can se the value for each environment. Within CRM you can refer to the environmental variable instead of hardcoded values:)

Within the solution explorer you can add Environmental variables that can be used across the different systems. In this test I am using a variable to define what environment I am working in “Test or Production”.

I wont be writing about the Environment variables in detail, as you can read more about them in other posts, but I wanted to cover the new way of using this within Power Automate!

Accessing the Environmental Variables in Power Automate Flow

Start by creating a new Power Automate, and add compose function

Check out that bad boy! 🤗😎 No longer need for get record calls from entities etc. A nice improvement that will save a few minutes here and there.

Power Automate – finding Dataverse environment URL

There are many ways of getting the current environment URL, but this is the quick and dirty version of doing just this 😏 Next week I will post about Environment variables as I know this is a possible approach that is better.

The intention about this blog is to show how to use Json to parse just a small part of an action body to get what you want exposed.

Power Automate

So this could be a typical flow in Power Automate for Dataverse. We have a trigger on top and an action below to get more data from the element that triggered.

The BODY of the trigger doesn’t contain environment information, but only Opportunity data:

But the Action contains a lot more interesting data for this.

In order to get this data we need to parse the Json returned here to retrieve the “Odata.ID” that includes the URL for our environment.

{
    "type": "object",
    "properties": {
        "@@odata.id": {
            "type": "string"
        }
    }
}

Now you can store the string returned in a String Variable

Running the Power Automate

When you run the Power Automate the the variable Environment will now include the URL of the system running. From here you can use string variables in a formula like:

IF “Environment contains org.crm4” etc.

In my next post I will show how the environmental variables functionality in Dataverse / Dynamics, and how we can use this for the same purpose 😀

Dataverse for teams DV4T – Exploring Data Migration

I will keep calling it CDS Lite in the smallest hope that this one day might get the name CDS Lite. It just makes perfect sense to give it a name like this. Allright, enough about the hope for a better naming future…

I know the system is only in preview and many things will change in the next months, but I thought I would give it a go at importing data from CDS to CDS Lite. I had no idea if this was possible, but I was curious to see how it would react.

At the moment there is no connecting to the database through normal tools I have had before

  1. XRM Toolbox
  2. SSIS – KingsWaySoft
  3. Excel Import

Every time I try to connect I get the response saying that I have to use an Oauth method to connect.

PS: Notice how Microsoft has put “LITE” in the error message? It’s a small hope, but it’s a hope 😂

So the only way I found out how to insert data in the Preview was via flow

Flow to the rescue

I am pretty sure that the current doc recommends using Flow for data to CDS Lite (Oakdale), but I am sure this will change in the future somehow. How else are you going to fill 2 million records (estimates from docs on the 2 gig DB size). Flow is not intended for data migration, but I had to use the tools I had available at the time 🙂

First I imported 5694 accounts to my CDS database (top row headings)

The CDS Lite (Oakdale) was empty for accounts, and only included the following columns.

The flow was a little tricky. I actually had to create the flow from the CDS Lite (Oakdale) environment. It did not work otherwise. Current environment connector was fine for writing to CDS – Lite (Oakdale).

The flow will only do 512 records if you don’t open up the paging. Go to settings of the connector and increase the threshold.

I started the flow and patiently waited.

27 minutes later the accounts had been migrated with a warning. I could only find 1 error in the migration, so I consider that a success. All of my accounts were now over to the CDS Lite (Oakdale).

What next

This is all just a beginning of a longer journey for the CDS Lite (Oakdale). Everything is in preview, so there are many things that will change once this is released, and a few years from now. I just wanted to see how to get data in to the system. The reason why might be more clear in a later post where I describe what I see in a future customer scenario for CDS and CDS Lite.

RegardingObjectID Type fix – Flow

How to fix the RegardingObjectID Type field in FLOW

When working with the Current Environment Connector (CDS), you have 2 options for a lookup (Value and Type). For some strange reason only one of them seems to work for me.

The Value is obviously the GUID, and the Type is “incidents, accounts, contacts, opportunities etc”.

Let’s look at the data:

As you see I have values for the GUID and the Type of regardingobjectid.

When adding them to the Compose the TYPE returns blank every time.

Peek kode

{    “inputs”: “@{triggerOutputs()?[‘body/_regardingobjectid_value’]}\n@{triggerOutputs()?[‘body/_regardingobjectid_value@Microsoft.Dynamics.CRM.lookuplogicalname‘]}”}

Flow is referencing the TYPE of lookup in a way that returned NULL every time.

Solution

Manually enter the expression:
triggerOutputs()?[‘body/_regardingobjectid_type’] <- change the VALUE with TYPE

PowerPlatform Saturday Oslo 2019 – Attendee

Malin and Mark wrote good post detailing most of the event, but I thought I would add my personal thoughts from some of the other sessions

Both Malin and Mark Smith wrote great summaries
Malin Martnes
Mark Smith

Keynote

Sarah and Marius were speaking of Equal Opportunity. A highly interesting topic that is as relevant today as ever before. One slide caught my eye that I really liked.

Take ownership of your own environment. Don’t wait for others to create an equal opportunity environment, and then complain if they don’t. If you see the chance to own a situation, take it.

If there is a table you want to sit at with a chair, take the chair and sit down. Don’t wait for others to offer you a place at the table. You take it if you want to be a part of it!

Sarah Critchley (quote as I could remember it)

I have grown up in a family where the women are strong, have great educations and excel at their jobs. I am sure they have faced issues along the way, but they keep claiming their place at the table every time they can.

Malin Martnes – Extending Talent

I am sure you all know how proud I am of Malin, so I couldn’t go without writing about her. Talent is not a product with lots of customers yet, but we are working on a lot of exciting opportunities at the moment. We are always in the challenger position when talking about this product going head to head with companies that have delivered HR for many years. This often ends up in a function feature comparison, but one thing we now can focus on is the ECO-System.

Talent integrates to the CDS, and therefore we can leverage all of the cool features of the PowerPlatform. Malin showed a lot of cool examples where PowerApps were assisting in the hiring process.

Stay tuned for updates on Malins blog about talent for our customer journeys later this year!;)

Julian Sharp – IOT

What I liked about this session was hot interactive it was, and how “low code” he was trying to make it. I gained some insights to the IOT challenges when gathering messages in different ways. Also I see the impact of having a device you can pass around in the room that is working while presenting. It was showing live data on the screen, presenting different messages to us as we were passing it along. He later posted the slides on Twitter

Jukka Niiranen – Canvas vs Model

I find it interesting to listen to Jukka. He is like a rapper’s lyrics when talking. There is often some deeper meaning to what he says if you listen closely. During this session he was open and honest about his view on the Canvas apps, and the battle Canvas vs Model is now facing. Will we ever get to the point where these 2 become 1? The answer is most probably, but how!! 🙂

He also had a wonderful slide with the great Scott Durrow in focus. I think we all agree that Canvas is absolutely becoming a code app, even though it might not be complex code. As a functional consultant I say code, but a developer says “cody” to the syntax;) hehe

Mark Smith

The pictures bellow are from Mark’s session. I really loved this session because he made the participants work! The topic was CDS modeling and what you should think about. He made it clear what was out of the box, and how you should begin to think about creating new models not based on the standard applications.

Anything interactive like this is just AWSOME. The participants loved it, and had a great time while working together on the data model. Interactive learning is the best way to learn.

So in conclusion, I had a great time at this event. Hope to repeat this again next year in Oslo. I also hope to see you all again soon:)

PowerPlatform Saturday Oslo 2019 – Speaker

So Power Platform Oslo was a unique experience for me, since it was the first time I was on stage at a community event. Marius Agur challenged me to create a presentation that would showcase my view of Dynamics from a business perspective. I am not the most technical person, so I try to create solutions based on simplicity for the end user within a “do it yourself approach”.

3 ways the Power Platform can increase user adoption

I was using our own company as example for this demo, and demonstrating the issues we have had when migrating from HubSpot to Dynamics 365. A journey with lots of bumps in the road, and long nights to figure out the best solution.

1. Connecting Flow to API

Part One showed how we can connect flow to an API and receive real time data from sources like Bisnode, Proff.no or in my case BRREG. I will blog about how to do this soon.

2. Creating a PowerApp for simplicity

Part 2 was showing how you can create a powerapp to simplify not only the user input, but also create a bridge between those who don’t like Dynamics CRM, but accept using a PowerApp, because it is new and fun. Blog about this will also come soon.

3. Integrating to onpremise data source

The last step was showing how we could integrate our CDS/CRM solutions to an onpremise ERP solution without a single line of code. Read more about hit HERE

People to thank

Chris Huntingford: @TattooedCRMGuy
I would never have even thought of doing community or personal exposure if it were not for your exceptional outgoing personality motivating me when you where in Oslo. I know it sounds odd, but I wanted to be like you, and spread excitement and joy to others. Somehow you made something in my brain say “why not” create a blog and speak my mind! MASSIVE thanks..

Megan Walker: @MeganVWalker
Getting to know you and understanding how you use the tools in regards of blog, wordpress, youtube has been very important. You were also so kind to be my first interview subject 🙂

Mark Smith: @nz365guy
Thank you for hosting the 90 day Mentoring Challenge. Even though you were speaking to the masses, you make it personal to participants. I have also shared many conversations with you that mean a lot to me. Thank you for guidance in som many different levels in regards to creating a profile. I might not be the fastest at getting everything done, but I will get there.

Malin Donoso Martnes: @MalinMartnes
Thank you for being persistent in your work. It inspires others to try:) You gave me the final push to submit my talk, and I don’t regret it!

CDS / Dataverse List Records Filter Query using Flow

This week I needed to use the List Records function, and I realized that I had no idea how to use the filters. Thank you Jonas Rapp for creating the FetchXML Builder!! The function “Flow List parameters” saved my day:)

Simple filters

Let’s begin with the simple filters where I get a contact with the last name of Sandsør

Test your search result with the Execute button so see that anything is actually returned. Then open the Flow List Parameters

The tool converts the Fetch XML, and magically gives the correct filter to add in our FLOW query. It can’t get much simpler than that!!

Lookups

Lookups act a little bit different with the syntax, as lookups always to. This got me quite confused before finding this tool, because I was not getting match to my result.

I am searching for contacts with a given GUID. In my case I didn’t know what the GUID was, so I randomly generated a GUID for the formula. In FLOW I substituted the GUID part of query with a dynamic variable.

Filter Query with lookups, you need to add “_” as seen above. When working with lookup you won’t get at match without the “_LookupField_Value”.

Filter linked entity

The last filter is a little more complex, and might not get used due to some limitations of Odata (Must match on unique ID for related).

In this scenario I wanted to locate all contacts with last name “Sandsør” where the regarding accountID = GUID.

Choose the main entity on top, and add “link-entity”

Make sure you have the correct relationship here. Some Lookups support more than one entity, and therefore you make sure you have the correct one.

Again we find the magic with the “Flow List Parameters“.

In this scenario we also get Expand Query result that we need to copy/paste.

Apply to Each

Once you have figured out what filter to use, you can select the “Apply to Each” function, and add custom logic in here.

Flow – Create, Update or Delete trigger error

At the time of writing this post Microsoft Flow will throw an error when you create this flow with the trigger Create, Update or Delete, and the flow is standalone.

Error

This is the following error you will see when you try to create the flow (Create, Update, Delete) without any connection to a solution.

Sollution

All you have to do, is open this in a solution (for the time being).