Monthly Archives: April 2021

Let’s have some fun – here is “Social Hype” monitoring Power App

The other day, I was wondering if I could, somehow, come up with an app that would be tracking twitter mentions of certain keywords, and, then, do some analytics on top of that.

And you know what? It took me 4 hours in total to get it up and running on Power Platform – the screen below is an illustration of how it worked out:

image

Forgive me, Microsoft. I tried making your bar higher, but Amazon has definitely taken the lead, and, then, there is Apple… but, at least, Tesla is lagging behindSmile 

What’s involved there?

There are a few pieces so far:

image

  • I’m using Twitter as a “data source”
  • In order to get the data from Twitter, I’m using a Power Automate flow
  • All the data is, then, stored in Microsoft Dataverse
  • And there is a Model-Driven Power App to present that data and to configure the search queries

With this in place, I could, now, add Power BI to the mix and start doing more analytics as I keep getting more data. I could also add other social platforms to the mix and start collecting data from there. Potentially, I might have to start creating custom connectors or add Azure Functions, too. The sky is the limit in terms of how advanced and how complex this can be, but that’s fine. Most importantly, it took almost no time not only to prototype the app, but to get a working version that’s already yielding some interesting output.

So, then, if you wanted to try it out, here is what’s involved:

1. Download solutions from git – there are both managed and unmanaged versions

https://github.com/ashlega/ItAintBoring.SHPMonitoring/tree/master/Solutions

2. Import managed solution into your environment – you’ll have to configure connections along the way

Just make sure to use maker portal – don’t use classic experience or those connections won’t be configured properly

image

I am assuming you have a twitter account, btwSmile

3. Once you have it imported, configure your first monitor

Open “Social Hype Monitoring” app and choose “SHP Monitors” in the navigation pane:

image

Start creating a new one – here is how you can set it up, for example:

image

For the search Query, since it’s only working with Twitter at the moment, here is a link to the Twitter search query syntax: https://developer.twitter.com/en/docs/twitter-api/v1/rules-and-filtering/search-operators

  • Once the monitor record above is created, it may take some time (up to an hour) before a Power Automate flow that’s scheduled to run every hour kicks in and starts processing those monitor records. Once it does kick in, you’ll start seeing data coming in. Here is how it may look like:
  • image

Each of those “SHP Monitor” records will have “SHP Stats” records linked to it. Those correspond to the individual data collection runs:

image

So, over time, there will be more of those for each SHP Monitor (and this is why there is “Frequency” column – that’s how you can control how often data collection should be happening).

And, yes, there are a few charts, though it becomes a little tricky. Charts are not available for subgrids (unlike in the classic interface), but you can still show/hide a chart if you navigate to Related->SHP Stats for a specific monitor:

image

In the meantime, I’m thinking of a bunch of things I could probably showcase using this app, so, maybe, that’s what’s coming next?

Have fun!

Adding CRUD to Virtual Entities

As everybody else has already noticedSmile, CRUD support has been added to the Virtual Entities:

https://docs.microsoft.com/en-us/powerapps/developer/data-platform/virtual-entities/sample-ve-provider-crud-operations

A while ago, I blogged about how we can use canvas apps with virtual entities, and there was a sample plugin there:

https://www.itaintboring.com/dynamics-crm/virtual-entities-revisited-setting-up-a-virtual-entity/

So, I figured, I’d just try updating that plugin to support create/update/delete. Since it is, already, supporting Retrieve and RetrieveMultiple.

It seems this should be really simple. All the details about the virtual record are supposed to be passed through the “Target” parameter of the plugin context

  • On “Create”, I should have the record being created there, as an Entity
  • On “Update”, I should have the record being update there, as an Entity
  • On “Delete”, I should have the record being delete there, but as an EntityReference this time

Updating the plugin did not take long, and you’ll see the code in git. Although, turned out I had to download updated version of the plugin registration utility, since, otherwise, there was no support for create/update/delete:

image

Actually, if you look at that screenshot above, there seem to be a remnant of how it used to work. There is still that note. That’s the past, we are in the present, so moving on!

Ok, let’s set it all up – I mean, let’s update data provide settings:

image

And click “update”… and there is an exception:

image

Not sure why that happened, but, apparently, registering a completely new data source worked:

image

Here it is, my new data source with a new data provider:

image

Why did it fail when I tried updating the original one? Not sure at the moment, but, with this new data source, I wonder if I can use it with the existing virtual entity. Otherwise, it would be a problem… so, let’s try that out.

Let’s go to the virtual entity configuration in the solution and pick the new data source:

image

Actually, that always gets me. There is no new data source. Not yet. First, we have to go to the Settings->Administration and create a new data source, even if that may sound a little counterintuitive. Did not we create a data source in the plugin registration tool? But we do have to add it to the list of Data Sources in the administration area – there are always these two steps involved:

image

Why do we need to define “data sources” in two different places? Not sure.

Now that it’s there, I can choose this new data source for my existing Virtual Entity:

image

Just had to add another main form (since the old one had that canvas app on it), and…

image

That’s a bummer. But… maybe, that “upgrade” path is not working yet? Let’s create a new virtual entity. An hour later, there is a new virtual entity and the plugin has been adjusted to fix a few bugs related to nulls, but, in the end, here we go:

It was, after all, a problem with the upgrade. Looks like that original entity has been somehow marked as “readonly” (might need to dig into the metadata, but that’s for another time).

I guess there are still limitations there (using advanced find, security roles, etc), but, with the CRUD support now… there is quite a bit more we should be able to use virtual entities for, eh?

PS. And here is a link to the updated date provider solution in git: https://github.com/ashlega/ITAintBoring.VirtualEntities