Luise Freese recently published a great blog on how to create a Flow for a Sticker request process. She asked for suggestions. My suggestion was to connect it up to Dynamics 365. So I did.
It all started with some tweets. I saw the Flow and was impressed by the idea. I noticed it was using SharePoint lists to store contact and request information.
So my idea was to use Dynamics 365 CRM for this. This workload is pretty good at storing contact information.
Maybe making a connection with a Dynamics 365 environment so you can track the people (contacts) and the sticker requests in that system as an alternative to SharePoint? Maybe it is a bit too much for this process, but it is always fun to try new Flow actions 😉 pic.twitter.com/cPeYW7Lr6J
— Dennis (@expiscornovus) March 26, 2019
So what does my second version of the Sticker Flow do? I am basically using a Dynamics 365 Customer Service environment to store the contacts and cases instead of a SharePoint list. I also added some checks to see if a contact already exist in Dynamics 365.
Below is an example of a case the new Flow will create.
Below is an overview of the new Flow.
To create this you will need a Dynamics 365 Customer Service environment. You can start a trial on this site.
Do I know this person?
In the first part of the Flow I will check if the person requesting the stickers is already known in the Dynamics 365 organization.
1. Search for the contact
2. Count the number of results
With the compose action I am validating the number of existing records it finds in the Dynamics 365 system. I am using the following expression.
3. Check for zero results
Creating a case for a new person
If it doesn’t find any contact records it will create a new contact record assign that newly created contact record to a sticker request case record.
1. Create a contact record
Add the Dynamics 365 ‘Create a new record’ action. It will use Microsoft Form fields as dynamic content. In my example I used a GUID for the Company name value. I will adjust this in a later version of the Flow.
2. Create a case record
Same Dynamics 365 ‘Create a new record’ action, different entity. This time it will create a new case. It will also use some of the fields from the previous action as dynamic content.
3. Create a note record
Use the Dynamics 365 ‘Create a new record’ action for this and use the note entity from Dynamics 365. Reference to the earlier created case by setting the Regarding field with Dynamic content.
I think I already know this person!
If it does find a single contact it will create a sticker request case and assign the contact record it found in the list records action to it.
If for some reason it will have multiple contact results it will connect the case to John Doe and sends a e-mail message to a specific person to manually adjust the case. It will still create the sticker document though.
1. Check if it is just one contact
2. Create a case record
The creation of the new case is similar to the action for the new contact. Only this time we will use the information the List contact records action.
I will use these expression above to avoid a Apply to each loop.
The rest of the actions are similar to the other part of the Flow.
What have I learned?
Checking if a contact exists in Dynamics 365 can be challenging. You can have multiple records in your results. So I decided to use a filter query that checks on first and last name.
Also it was interesting to use a compose action and an expression with a length function to give back the number of records. But there are probably some other ways of determining that though.
And finally I am also glad that I have learned to use expressions to get a single value of a field without getting an apply to each loop. I learned this at the Microsoft Ignite The Tour session BRK3454.
Hopefully you will find my experiment useful. Happy testing! 🙂