Dynamics 365 Software Deployment and Flow: The Good, the Bad and the Ugly

Standard

Of the developers I talk to, there are mixed feelings towards Microsoft Flow. There are a few reasons for this such as:

  • It is quite new and a little buggy in places
  • They do not get full control to bend it to their will (the reason they are a little less hostile towards Flow’s big brother, Logic Apps, where they can access the underlying code)
  • It provides Power Users with a lot of power but does not strongly enforce discipline/good development practices (this is improving with the new policy framework available for the Premium edition)
  • There is little guidance on managing Flow as part of software deployment

All of the above are true and developers have reason to be wary. However, the same concerns were raised when Dynamics CRM got Workflows and we learned to work with them (although there is still room for improvement in most implementations in regards to refactoring and taking advantage of Workflow properties such as scope.

In this blog I will go through what I have discovered for managing Flows as part of a Dynamics 365 implementation.

What Do I Mean By Software Deployment?

I have also seen this called the ‘Software Development Life Cycle (SDLC)’ but, basically, I am talking about the idea that you do not develop in a production environment but still need a simple way to move a developed solution to production with a minimum of fuss and human intervention.

A simple architecture involves a set of environments with the developed solution progressing through them to production.

image

Method 1 (The Good): Two Environments (Premium Option)

With a Premium Flow plan you get two Flow environments and the ability to export a Flow as a ZIP file for importing elsewhere. While more than two environments would be nice, it is a good start. Let us call our two environments DEV and PROD.

In this scenario, a new Flow is developed in DEV and then exported to a ZIP file via the Export option for the Flow.

image

When we do, we get a number of options for our ZIP package.

image

For the Flow itself, we have the option of having it update an existing Flow (as shown above) or we can make it create a new Flow for us in the target environment. While it looks like there are options for the Connections as well, the only option available to us is to select the Connection on import. We can also add in comments to guide the user during import.

So we can imagine we have our DEV environment with DEV Connections and PROD with PROD Connections. This is good as it means it is unlikely a user will connect, say, a Flow being developed to a production Connection accidentally.

To import, we go to My Flows and the Import button is at the top on the right hand side of the page. When we import the ZIP package we see the following.

image

As can be seen, any comments we added are available and it is now a case of clicking on the blue text for the Connections, linking them up to the Connections in the target environment and we are good to go. We can also create new Connections, if required.

For the Update option, the user can change this to create a new Flow, if they choose to.

Once the Connections have been selected, the Import button becomes blue and you are good to go.

Method 2 (The Bad): One Environment (Non-Premium Option)

Almost certainly by design, Microsoft have made it that if you are serious about managing Flow as part of a software deployment, you will need a Premium account.

image

So, given we cannot export a Flow out of our environment, the option of moving it is not available. Also, we only have the one environment to work in; no more DEV and PROD. Therefore everything has to sit in the one place.

clip_image002

Unfortunately, this is a disaster waiting to happen. We need to manually turn Flows on and off and the Connections to all environments are available for manual selection. It would be very easy to make a mistake in this setup and cause significant problems for production.

Method 3 (The Ugly): Using Flow Management

The last method I tried was my most ambitious. Flow now has a Connector to manage Flows. You can literally create, delete and modify a Flow with a Flow. This holds a lot of potential from a software deployment perspective because it means, for example, we could set up a Flow which deploys our developed Flow from DEV to PROD at the press of a button; deployment nirvana.

As Dynamics 365 CE (the new name for Dynamics CRM) already has a deployment packager (Solution files), I wondered if we could use Flow Management to push a Flow into a Solution and then piggy back on the CRM deployment process.

This proved to be frustrating and ultimately failed but I still hold hope for this technique. Here is what I discovered.

I Could Not Select a Flow from Flow Management

While we can add a text input to a Flow’s manual trigger, there is not yet a way to search and retrieve a Flow by its Display Name. You literally have to specify the Flow’s ID to retrieve it, which is essentially impossible for the user to know.

image

Without this ability to find a Flow based on a property other than its ID, it makes it hard to create a generic deployment tool for Flows and we literally have to create a deployment Flow for every Flow we plan to deploy, hardcoding the Flow ID into the deployment Flow definition.

I Could Not Put the Flow Definition in a Text Field

This appears to be a fundamental bug in flow at the time of writing. While the slug for the Flow’s definition is available and the documentation specifies it is text, if you try and put that definition in a text field as part of your deployment Flow you get an error:

” ‘The template language expression ‘body(‘Get_Flow_as_Admin’)[‘properties’][‘definition’]’ cannot be evaluated because property ‘definition’ doesn’t exist, available properties are ‘apiId, displayName, userType, triggerSchema, state, connectionReferences, createdTime, lastModifiedTime, environment, definitionSummary, creator, provisioningMethod’. Please see https://aka.ms/logicexpressions for usage details.’.”

Translating with the help of CRM development guru George Doubinski, the slug is looking for ‘definition’ but the only thing available which comes close is ‘definitionSummary’. After hacking around in the Flow interface I managed to convince it to ask for the definitionSummary and got back what looked like a definition for the Flow.

I Could Not Put the Flow Definition into the Content Field of a Web Resource

My grand plan was simple. Get the Flow into a Web Resource and then add this Web Resource into a CRM Solution file. Then it moves across, out of DEV, with the other CRM components. Perhaps I was selecting the wrong type of Web Resource but I struggled to get the Flow definition to appear in the Content field. In the end, for the sake of expediency, I pushed it into the Description field of the Web Resource instead.

image

I Could Not Use This Definition to ‘Rehydrate’ My Flow

While it was possible to read the text file into a Flow and set it as a definition of a new Flow via Flow Management, the Flow failed

image

In the end the issues were insurmountable and I have chalked it up to revisit in six months or so when Flow Management, and Flows in general, are a little more mature.

Conclusions

There is still some way to go for a practical solution for non-Premium accounts to manage Flows as part of a software deployment process but we have the start of a process for Premium accounts. By all means see if you can work around the issues I had in using Flow Management to move a Flow into a CRM Web Resource and let me know if you have more success.

Advertisements

Linking IFTTT With Flow

Standard

Often when people talk to me about my blog, it is my old posts on workflows which they remember with the greatest fondness. For example, I created an audit log for v4.0, auto-number solutions, and even a global search tool before it was a thing. Then dialogs came along (deprecated now so do not get too attached) and I showed how to create multi-select option sets, a timesheet entry system, and a text-based adventure game. I think Flow is going to be my new source of non-coding shenanigans.

My first piece of fun is linking Microsoft Flow with IFTTT to update a currency exchange rates in Dynamics 365.

What is IFTTT?

This is a bit of a circular definition because in my first part of introducing Microsoft Flow I likened Flow to IFTTT. Now I am doing the opposite. Essentially, both of them allow you to link different web services together to do interesting things. For example, my Flow introduction had an email create an attachment in the SharePoint document store of a Dynamics 365 Contact record.

The Design

The trick to linking IFTTT and Flow was finding a way for information to pass from one to the other. There are a number of services both attach to but, to keep things simple, I selected email.

Essentially, IFTTT reads the latest US to AUD exchange rate, puts this in an email and sends it to a predefined email address (in this case my Gmail address). Flow monitors my inbox and when it sees an email with the right format, it extracts the exchange rate and updates Dynamics 365.

image

The IFTTT Bit

Setting this up was very, very easy. I logged in to IFTTT with my Gmail email address, set the trigger to be ‘Stocks’, picking the exchange rate trigger option with the action being ‘Gmail’

image

Other than setting parameters, such as the currencies, the only other modification I had to do was to the ‘Ingredients’ (what we call Slugs in Dynamics 365) so that the subject line of the email was precisely formatted.

image

At midnight, IFTTT kicks in and sends an email to Gmail with the subject “FLOW <exchange rate>”. Here is what it looks like.

image

The Flow Bit

I have purposely kept things simple in Flow as I covered some of the finer points in my three-part introduction articles.

image

The trigger is ‘When a new email arrives’.

image

I have limited Flow to only worry about emails from action@ifttt.com and I also have the option of filtering by Subject string if I need it, although I have managed that later on the Flow.

Next I set two variables. The first is “SUBJECT” which is a string and is set to equal the Subject of the email. The second is “RATE” which is a float and will become the new exchange rate.

Then I check a condition. In this case I am simply looking for any email whose Subject begins with ‘FLOW’. It is not hard to see we could have different Flows using different keywords to determine whether they should fire or not.

If the condition fails, nothing happens. If it succeeds, we set the RATE variable to the exchange rate in the email. For anyone who has used Excel formulae, this is not too difficult to master.

The Expression to use is:

float(replace(variables(‘SUBJECT’),’FLOW ‘,’’))

This simply removes the “FLOW “ at the start of the email Subject and converts whatever is left to a value of type float.

Finally, we update the appropriate Currency record in Dynamics 365.

image

There are a couple of things to note here. Firstly, all the mandatory fields in CRM are mandatory here, even though we simply want to update one field. This means we need to type in values for Currency Name, Currency Precision, and Currency Symbol, and the Exchange Rate. Secondly, I have hard-coded the Guid (the Record Identifier) although this could be easily retrieved using the search trick from the third part of my Flow introduction.

The Result

The result is an exchange rate in Dynamics 365 which is updated every 24 hours at midnight.

image

Is Flow the Future of Development?

It is true that because we can do something does not mean we always should. Such is the case with Flow. Just because a citizen developer can develop some very interesting Flows, we still need appropriate governance and management and sometimes this will mean traditional development is the better option.

Taking the above as an example, if we implemented our IFTTT/Flow combo into a production system, we now need to maintain an IFTTT Applet, a Flow, an email address in Gmail and so on. We can imagine that doing this for a dozen such arrangements becomes unwieldy.

Using development, we can centralise the configuration in one text file (or custom entity record) and create a console app to retrieve the exchange rate. As an example, Matthew Foy walks us through how to do it here for an on-premise Dynamics CRM implementation.

Also, as with any developed functionality, security need to be considered. Could someone mess with my Dynamics 365 system by sending an email with a bogus exchange rate in it? Where is my data going and can it be intercepted? Again these issues may be easier to manage in a developed solution.

Conclusions

We have some amazing power in our hands with Flow and even more so when we combine it with IFTTT. The trick for many organisations will be finding the balance between the rapid development of functionality using tools such as the above, and ensuring the result is maintainable and secure. For me, I will continue to work with Flow, coming up with codeless solutions to common Dynamics 365 problems, and continue to blog about them to give people an idea of how far they can be taken.

Understanding Scrum with Dynamics 365

Standard

“Understanding the rules of chess does not make you a Grand Master and
understanding the rules of Scrum does not make you a Scrum Master”

I have been on a project now for a little over 12 months. While I have customers who I have assisted for over a decade, I have never worked full time for so long on the one project. Moreover, unlike many of the projects I have worked on in the past, this one is being delivered using the Scrum framework; it is an Agile project.

There are those that claim while Agile may work for short projects, it is unsustainable for longer projects. Much to my own surprise, this has proven not to be the case. We began with two week Sprints for the first three months and then moved to three week Sprints and have been doing this ever since. We have delivered a lot and the project is being hailed as a success by both KPMG and the client.

I am also about to take my PSM 1 (Professional Scrum Master Level 1) exam so I thought I would give an introduction to Agile (and Scrum specifically) to those who are still unsure what it means. The good news is if you understand Dynamics 365 (CRM) you already have a good mental model for understanding Scrum.

What is Agile?

Agile is a catch-all for delivery frameworks and methodologies which focus on quick iterations to deliver and receive feedback. The alternative is ‘waterfall’ where a lot of design and planning are done up front and delivery is more comprehensive in its first delivery but takes longer to complete, providing less opportunity for feedback along the way.

Of the various Agile approaches, Scrum is one. Scrum focusses on transparency, inspection and adaptation. It reminds me of six sigma in that it promotes the idea of constant evaluation and improvement. To begin our analogy to Dynamics 365 (CRM), Agile is like the collection of all CRM systems in the market and Scrum is just one of them. All of the CRM systems have similar characteristics with differing emphasis, strengths, and weaknesses.

What is Scrum?

Scrum is a very specific Agile framework for delivering complex projects. I am actively avoiding calling it a methodology because it is not that prescriptive. If we consider Dynamics 365 (CRM), it is very rare that a CRM project is delivered with no configuration or customization. Dynamics 365 (CRM) is the framework on which we build a system to manage the processes of a business.

Similarly, Scrum is the framework on which the processes for managing project delivery are built. Just as we add in custom entities to fill in the gaps in CRM, so too we add tools to fill in the gaps in Scrum. For example, concepts such as ‘Epics’, ‘User Stories’, and ‘Tasks’, while commonly thrown around, are not part of Scrum but are one way we can track progress and productivity. We could easily use another approach though and still be within the realms of Scrum.

How Do I Learn More About This Framework?

Like Dynamics 365 (CRM) where you can understand the essentials of the framework by taking a Microsoft Certification, so too you can take an exam to appreciate the essentials of Scrum. This is the exam I am about to take. Also, just as being a CRM consultant is much more than just a piece of paper signed by Satya, so too being an expert at delivering with the Scrum framework is much more than sitting a one hour exam.

The good news for the Scrum-curious, is it is much easier to get across the essentials for Scrum that it is for Dynamics 365 (CRM). If you go to http://www.scrumguides.org/ you can download The Scrum Guide. Read this 17 page document and you know everything you need to get the base level of certification. Moreover, the document has not been updated since July 2016 so none of this six-month cadence nonsense. As a word of warning, the document is not the best written and could be a little more concise but it is easy to read and the information is readily digestible.

Reading the document you will see it sets up a bunch of restrictions, just like CRM sets up restrictions for configuration and customization and, in both cases, it is not immediately obvious why it has been devised the way it has. My advice is to run with it, and see how it goes. Just like CRM, you can always go ‘unsupported’ if you are finding an aspect of Scrum is incompatible with your situation.

Also, scrum.org has an online trial exam (unlike Microsoft certifications) so you can sharpen up your skills before getting certified (yes, it does cost money to sit for the actual exam).

Conclusions

There are a lot of opinions about Agile and Scrum and they are usually expressed by people who have been involved a project where they were told it was being run under a Scrum framework but was little more than ad hoc development with no documentation. If you are interested in Scrum, check out the 17 page document. I am not a glassy-eyed convert yet but it is fair to say my project has run smoothly and delivered consistently over the 12 months and I am hard pressed to recall one of my waterfall projects which can claim the same thing.

Salesforce: Second Quarter Second Wind

Standard

How quickly time flies. Doing my three-part Flow blogs meant my review of the Salesforce second quarter results was delayed. Salesforce is again flirting with profit but at the cost of growth. Let us set sail.

Whispers on the Wind (Salesforce in the News)

Benioff Closing the Gender Pay Gap: A good news story. Benioff has been steadily working to eliminate the gender pay gap at Salesforce. So far he has thrown US$6m at the problem. This is a good thing. Looking at the executive (five women to seven men is not bad) they are doing well compared to many companies although the board (three women to nine men) still needs a bit of work (not that Microsoft’s board is any better). See if you can spot Marc in the line up. Hint: he is the one who cannot look at a camera.

image

Salesforce vs Dynamics 365: Not a bad summary of the differences

Salesforce Culture is About Control: This is an article about a couple of Salesforce speakers who spoke out of school at a conference and got fired for it. This is one of the big differences between the Microsoft and Salesforce cultures.

As an MVP, for example, I can say pretty much whatever I like about Microsoft and Dynamics 365. I can talk at whatever conference I like and Microsoft has no say in the matter. If I was asked to go on stage at Dreamforce and talk about the ten biggest things that suck about Dynamics 365, as long as I do not break NDA, Microsoft would not stop me. I never ask permission from Microsoft about what community activities to engage in, ever, and neither does any other Microsoft MVP.

In contrast, Salesforce MVPs need to get permission from Salesforce for their speaking engagements. If Salesforce do not like the idea of one of their MVPs speaking at a specific event or engaging in a specific interview, that MVP can either go along with Salesforce or risk losing their status.

In other words, Microsoft MVPs are community advocates whereas Salesforce MVPs advocate in the community.

The Prevailing Winds of the Stock Price

image

Clearly the market was favorable towards Salesforce over this quarter taking the stock from around 90 to just over 95 (stock currently at 93). As we will see, Salesforce edged into profitability this quarter which may explain the rise but, usually, it is growth that gets the market excited, not boring sustainability.

Where the Wind Blows (Numbers of Note)

Salesforce Turns a Profit

image

Salesforce has edged into the black this quarter with a margin of 0.7% ($17m in profit). As can be seen, the graph is erratic and not under control but it is heading in the right direction. Let us see if the other numbers of note can explain how they got there.

Stable Revenue Growth

image

Annual revenue growth has been remarkably constant, at around 26%, over the last two years. In contrast, cost growth has danced around over the same period and has gone from being at a historic high last quarter to being on par with revenue growth.

This is certainly key to profitability. You cannot become more profitable unless your revenues grow faster than your costs. Reining in the costs can only be a good thing. Where cost growth will go from here is anyone’s guess but one hopes it continues to go down.

Staff Growth

image

Staff growth, while still growing, is the slowest is has been for two years. This could be part of the explanation for the profitability. If Salesforce can get the same workforce to do more work, they increase productivity without increasing salaries. The motto at Salesforce used to be “every month is end of quarter”. Maybe it is now “every week is end of quarter”.

Transactions are Declining

image

I have mentioned before that I do not understand the server transaction numbers when compared to the revenue growth of the company. One would expect that revenue is a function of subscribers and server transactions would also be a function of subscribers but while annual revenue growth is constant at around 26%, the number of server transactions is actually shrinking.

At the time of writing (30 September) the largest daily transaction, according to Salesforce, is 5.7b transactions on 28 September. In comparison, when I wrote the last article, three months ago, the largest was 5.8b. Somehow, in three months, revenues have gone up but transactions have gone down. I can only think that the Salesforce services in high demand take less computing power than the less desired ones. It is strange, though.

Three Sheets to the Wind (GAAP vs Non-GAAP)

Image result for four hurricane cocktails

GAAP did get mentioned twice but NON-GAAP (the watered cocktail of the accounting world) got mentioned six times so we have four hurricane glasses this quarter (image courtesy of http://www.wowcher.co.uk).

I continue to predict that if profitability continues GAAP mentions will increase.

Lots of Hot Air (Buzzword Bingo)

2017 Q2

2017 Q3

2017 Q4

2018 Q1

2018 Q2

Number of words

2511

2505

3317

3278

3000

Customers/Customer

17

20

26

28

25

Revenue

19

18

31

28

21

Cloud

16

12

14

22

16

Growth

9

10

15

16

19

Operating

6

3

18

11

7

Salesforce/Salesforces

20

18

40

26

Nothing has changed on the buzzword bingo front. It is the same keywords which have got ten or more mentions over four quarters. We can see an increasing emphasis on growth (despite revenue growth being flat) and no focus on profits (of course).

Which Way the Wind Blows (Future Prediction)

Last report I predicted revenues of $2.5b (we got $2.56b so all good there) and breakeven which is also close to the 0.7% margin achieved so I am quite pleased with myself.

For next quarter, I predict another profitable quarter (maybe $30-40m) on revenues of just over $2.7b.

Conclusions

Nothing too exciting to report other than Salesforce achieving the unicorn of a legitimate profit. It will be interesting to see if profitability increases and, if so, what happens to growth. So far Salesforce has managed to keep revenue growth constant but profitability will put pressure on this as marketing and sales dollars are restricted.

Also, what of that weird transactions result? Next quarter will reveal whether this was an outlier result or a continuing trend. If transactions continue to decline, what does this mean for Salesforce and their future prospects?

Microsoft Flow Part Three: The Flow That Worked

Standard

In Part One we learned how to get started and in Part Two I introduced you to a simple Flow albeit one that did not work. In this blog we will see an alternative approach which achieves our goal.

The Mission We Chose To Accept

The problem to solve was bringing scanned documents into CRM, preferably via email. The out of the box option is to email the attachment to yourself and track it in or save the attachment and add a Note. As the client already had a coded solution bringing in attachments via Queues in CRM 4, the out of the box options were considered a step backwards.

Workflow could not quite get us there without a custom workflow step so I looked to Flow. In Part Two I tried the direct approach of simply reading the email and creating a Note in CRM. Unfortunately, Flow errors when you try and move the attachment across to CRM so I had to try something else.

The SharePoint Option

My salvation came with the client turning on SharePoint integration for Dynamics 365 (CRM). For those that are unfamiliar with this feature, you go into Dynamics 365’s settings, tell it where the SharePoint server is and which CRM entities you want it on for and SharePoint auto-provisions a document store for each record of that entity available in the Documents child link of the record (accessible from the chevron at the top).

image

Starting the Flow

Flows allow us to use variables and, for this particular Flow that makes life a lot easier. To this end we start out Flow with the trigger for the Flow and initialising our variables.

image

Our trigger is the same as in the Part Two Flow; we monitor everything coming into our Inbox. Each variable initiation requires a name, type and, optionally, a default value. The default value can be an expression, rather than a string if you want to get tricky.

image

For the purposes of this Flow we initialise three variables for the Contact’s GUID, First Name, and Last Name (all for constructing the folder path for SharePoint). In this case, I was not tricky and just set some sensible text for the default value.

The next step is to find the Contact we are going to add the attachments to.

image

The only complicated bit here is the Filter Query value. The format for an ODATA filter can be found online without too much difficulty and for my purposes can be seen above where I equate the system name of the CRM field on the Contact entity to the Subject of the incoming email.

Loops and Arrays

I hit a small problem at this point. While the contactid was unique to each record, and only one record would be returned, the List Record step returned an array (effectively a list of records). Array manipulation is not obvious in Flow but colleague and Microsoft Azure encyclopedia Doug Daley tells me you can isolate array components with the Compose function. At the time of writing I did not know this trick so I employed a loop to loop through each element in the array (of which there was one, the found Contact, or zero if none were found).

I have also found Flow is a bit twitchy when it comes to creating loops. If you try to create one and then add an array variable to work on, the Flow does not always realise you are in a loop and complains about the array. The best best is to NOT create the loop but add the step as if it was in a loop. Flow then asks if you want to put it inside a loop and you are good.

image

So what we are doing here is, once we have identified the Contact in question, we set values for our three variables. Flow makes this very easy as it automatically retrieves all the fields for the Contact entity.

Our final step is to loop through our attachments and, using these variables, place them in the right folder so that they can be seen in CRM.

image

Starting another loop (by adding a Create File step and getting Flow to build the loop around it), we get each attachment from our email and add it to the right folder. The SharePoint Create File step requires:

  • Site Address: The SharePoint Site Address. I have had some real trouble getting the value to stick in this field with Flow blanking it out whenever I clicked away. The only advice I can offer is to persist.
  • Folder Path: For us this is the formula used by Dynamics 365 (CRM). For Contacts, we use the following Expression. “concat(‘/contact/’,variables(‘FIRSTNAME’),’ ‘,variables(‘LASTNAME’),’_’,replace(variables(‘GUID’),’-‘,”))”. Basically, it uses a subfolder called ‘contact’ and after this each Contact record gets a folder with the name ‘<full name>_<contact GUID>’. If you are doing this for a production environment, consider that the full name is not always ‘<first name> <last name>’ so you may want to pull the <full name> field or construct your Expression differently.
  • File Name: The name of the attachment
  • File Content: The encoded content of the attachment. This is the part that Flow struggled to pass onto a CRM Note record. Fortunately it works fine for SharePoint.

The End Result

image

The Flow worked exactly as we would hope and a new file was created against the appropriate SharePoint folder so that the attachment could be seen in CRM.

image

Conclusions

We replaced non-trivial and, likely, expensive coding with a completely configured Flow. Moreover, I went from knowing essentially nothing about Flow to creating the above in a few hours.

In the end the client actually took the Flow further and, as the attachments were application forms, requested that for each attachment a Case was created and that the attachment was placed on the document store for that Case. It took a little over an hour to get it fully functional from scratch. I will leave it as an exercise for the reader on how to do it.

Looking at the soon-to-be-released update to CRM, erroneously known as the “July Update”, it is possible to start the process for creating Flows directly within CRM.

image

Therefore I think Flows will become more and more important as time goes on for those of us who work with Dynamics 365.

Microsoft Flow Part Two: The Flow That Failed

Standard

In Part One I talked about how to set up a new Flow trial and the key elements which make up Flows. In this one I will show my first attempt at creating a Flow (even though it failed) as it is a good, simple example.

My Mission: Bring Attachments Into CRM

The problem to solve was to bring attachments into Dynamics 365 (CRM) from a scanner. The client was using Dynamics CRM 4 and had written some code such that a scanned document was sent to an email address, with the “Contact ID” in the Subject of the email. The email then hit a CRM Queue, the code kicked in and the email attachments appeared under the Contact.

Obviously the client wanted a process similar to the old one to minimize disruption.

Starting With a Template

A good place to start in Flow is a pre-written template as this will save some of the configuration. There was no Exchange to Dynamics 365 template but there was an Exchange to OneDrive template which scraped the attachments from emails and put them in OneDrive.

image

A bit further down the screen is the Create Flow button which gives you a copy of the template Flow (deactivated by default) to work on. Click the Edit Flow button on the screen that appears to get into the details.

image

As you can see below, Flows are fairly straightforward. In this case there is an Office 365 Exchange Trigger which activates the Flow when a new email is received into the Inbox. A loop then kicks in which goes through each attachment in the email and creates a file in OneDrive in a specified folder.

image

What is also quite nice about Flows is, if you log in with an Office 365 account, it automatically connects to the relevant services i.e. Exchange and OneDrive.

Modifying the Template to Suit Our Needs

As can be seen in the previous screenshot, clicking the ellipsis (three dots) next to the Create file Action allows us to delete the action. In our case this is exactly what we need to do, replacing it with a Dynamics 365 (CRM) action.

Once the Action is deleted, you mouse over the same area and click the ‘+’ sign that appears. Selecting ‘Add an Action’ presents all Actions available in Flow. To get to Dynamics 365 click ‘See more’.

image

Sure enough, there are three Dynamics 365 options with the only thing to differentiate them being the icon. Ours is the first one, Dynamics 365 (not ‘for’ anything).

image

Dynamics 365 has a few options available for us and we have triggers on creation, updating and deletion.

image

In our case we chose to Create a new record (a Note).

Flow is clever enough to retrieve the entities and fields of CRM and also allows us to choose the key attributes of the source email and its attachments.

image

The final step is to update the Flow and activate it (which you can do on the screen that appears after updating).

Running the Flow and Seeing How it Went

Going to My Flows and selecting this Flow shows the summary screen, including when it has been executed. In our case, we simply send an email to the monitored Inbox and wait a few minutes. Unfortunately, in our case, the Flow fails.

image

We can click through to one of the failed runs to see the details, including the inputs and outputs of each step.

image

Interestingly, if we remove the Document and Mime Type, the Flow works fine so there is a bug with the creation of attachments. My guess is however emails manage attachments is not quite compatible with the way Dynamics 365 does.

The good news is there is another way and I will show this in the last part of this series. We will also learn about programming Flows without code.

Microsoft Flow Part One: Introduction and Setting Up a Trial

Standard

I have finally got to learning the basics of Microsoft Flow. If, like me, the curly brace keys are most under-utilized keys on the keyboard, you have a new best friend. My first mission was to bring attachments from emails into CRM. In a couple of days I have gone from zero to achievement unlocked. For the Flow curious I thought I would walk through how to set it up. There is a bit to explain so I will split this over a few blogs (probably three). This one will introduce Flow and show how to set up a trial.

What Does Flow Do?

The usual explanation for Microsoft Flow is “Microsoft’s If This Then That (IFTTT)”. If you are familiar with IFTTT, essentially Flow provides a series of Connectors which link to various online apps and you then chain them together to do something. For simple migrations and integrations, Flow offers a configurable and more manageable alternative to code.

To compare to CRM Workflows, Workflows are great at moving data around CRM and performing actions. Flows allow you to do this beyond the boundaries of CRM, interacting with products such as OneDrive, Exchange, and SharePoint (as well as quite a few non-Microsoft ones).

Getting a Trial

This is by far the easiest trial I have ever set up for a Microsoft product. Go to http://flow.microsoft.com and click “Sign up free”.

Follow the prompts and you will get a 90 day trial. Alternatively, if you already have an Office 365 account, sign in with this to make linking to your Office 365 products automatic.

image

Connectors

To see if the things you want to talk to each other are available for Flow, go Connectors. Here you will be presented with all available Connectors, including Dynamics 365 (CRM).

image

There are also some non-system Connectors called Actions (available when setting up the Flow) such as:

  • Approvals: Services for Approval Flows (discussed briefly later on in this blog)
  • Content Conversion: Not the most extensive of services but it allows HTML to be converted to plain text (maybe useful when turning emails into things like Cases)
  • Data Operations: Reasonably self-explanatory but here are the specific services offered

image

  • Notification: To send a mobile or email notification as part of the Flow
  • Schedule: To insert delays in your Flow
  • Variables: Useful for passing ‘bits’ between the Steps in your Flow and for using in loops

image

NB: Approvals and Content Conversion sit under Connectors in Flow but are Actions in my mind

Templates

Fortunately, we do not have to start from scratch when linking Connectors and Actions. Microsoft provides a large set of Templates to base your Flow on. Going to Templates, shows a series of pre-made Flows which are very useful as a starting point.

image

Other Bits

For the purpose of setting up our sample Flow we now have everything we need but there are other sections on the page:

  • My Flows: Where the Flows we make reside
  • Approvals: Specifically for setting up approval processes
  • Learn: A bunch of tutorials, documentation and the like to get you on the right track

image

In Our Next Episode

In my next blog I will show the Flow that failed (Taking Exchange email attachments and creating CRM Notes from them) and then in the last blog how I went to SharePoint to solve the problem.