Horsing around with Microsoft Flow

By | November 24, 2016

The slowest endless loop on earth

The other day I was horsing around with Microsoft Flow and for no apparent reason my inner rascal wanted to know if I could fill up the database using only Microsoft Flow and the creation of 1 Account record in Dynamics CRM…

Setting up a loop using Microsoft Flow

I have an Dynamics 365 online environment for which I have set up 2 flows in Microsoft Flow.

image

When an Account is being created in Dynamics 365 the ‘CRM to SharePoint’ Flow will add a new item in a new list I made in SharePoint.
And when a new item is added in my SharePoint list the ‘SharePoint to CRM’ Flow will create a new Account in Dynamics 365.

The first thing I noticed is that the active Flows seem to perform some sort of check to see if they are required to run. I purposely did not make any changes in Dynamics 365 or SharePoint and it seemed that both flows perform said checks at random intervals. The Flows are started and then move to a ‘Skipped’ state because they are not required to do anything.

image

Both Flows are enabled and actively checking for triggers so we can create an Account and let the Flows do their thing.

This is not so fast

After creation of the Account in Dynamics 365 it took 9:53 minutes before the Flow came back from SharePoint and created a 2nd Account in Dynamics 365…

I have no idea in what timeframe Flows are supposed to execute and not much is to find about it in documentation or on the web. But my findings are that they are executed every 2 hours (more or less) except for the first time.

image

This also shows in the creation of the records in both Dynamics 365 and SharePoint.

Dynamics 365

5

And in my SharePoint list, that is apparently by default in a different time zone whilst being on the same account.

6

This raises some questions:

  • How is the execution of the Flows determined? Since I have had intervals of both 10 minutes and 2 hours. Does this have to do with traffic, time of the day, …?
  • Is just over 2 hours the maximum time interval or could your Flow take a whole day?
  • Does this only happen with Flows using data coming from Dynamics 365? Since the delay is in the creation of the SharePoint record from Dynamics 365 and not in the creation of the Account coming from SharePoint. Or only this specific Flow? I don’t know!

17 December 3887

If I don’t deactivate my Flows my setup will run out of storage on 17 December 3887!

I am using an online environment with 5GB of storage. The default setup of my system with my Dynamics 365 environment, SharePoint, my Flows, etc. uses 509MB or 10.18% of my total storage.
If I create an Account record in Dynamics 365 using only a name my record is around 274 bytes in the database (I checked on premise because there I can query the database). Assuming my SharePoint record has the same size (I know, it’s not accurate) it would take 1871 years and 23 days to reach my 5GB limit.

Not really worth it.

P.S.: Snippet to list the size of your records in a table and order them big to small

declare @table nvarchar(128)
declare @idcol nvarchar(128)
declare @sql nvarchar(max)
set @table = ‘AccountBase’
set @idcol = ‘rowid’
set @sql = ‘select ‘ + @idcol +’ , (0’select @sql = @sql + ‘ + isnull(datalength(‘ + name + ‘), 1)’from sys.columns where object_id = object_id(@table)
set @sql = @sql + ‘) as rowsize from ‘ + @table + ‘ order by rowsize desc’
PRINT @sql
exec (@sql)

Leave a Reply

Your email address will not be published. Required fields are marked *