Personalized Community is here!
Quickly customize your community to find the content you seek.
‘Better Together’ Integration forum available
We're launching a how-to forum where you can learn and engage about how Dynamics 365 integrates with other Power Platform products.
Read about Better Together forum
2020 Release Wave 2Discover the latest updates and new features to Dynamics 365 planned through March 2021.
Release overview guides and videos Release Plan | Preview 2020 Release Wave 2 TimelineWatch the 2020 Release Wave 1 virtual launch event
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Upcoming TechTalks
Recently I receive the challenge from one of our sales people, if we can send automatically summary emails for a weekly created Lead. For example at the end of the week to receive an email of how many Leads have been created from Monday until Friday. (Same logic cab ne used for other entities as well, depending on the scenario).
This article is a mix of suggestions, forum topics and reading combined to together to achive my scenario. Feel free to spread the news and even get back to me if you have ideas how to develop it even further.
Since there isn't out of the box option in CRM to archive that, so I knew that my only option will be using somehow Power Automate (ex. Microsoft Flow).
This is how the overall of the Flow looks like.
For a test purposes I set the flow to start every 3 days at 09:00AM, but I think in our scenario will needs to be perhaps every Friday at 5 or 6PM (after work hours), or maybe Monday morning? Anyway…..
Here we want all Leads created in the past 3 days.
Remember: The more days ago you set the Flow to get records, the longer will takes for the Flow to complete, it can even reach time out if there are too many records.
You see, when we receive the email with the Leads, Cases or what so ever we want to extract from CRM, we will have no problems with the strings and date and time fields on the forms, however if we also want to get information such as; who is the owner of the Lead, who is the Account or the Contact, this fields are Lookup type and they will only return the GUID (Global Unique Identifier) of the records in the following format.
That really doesn’t tells us much, unless if someone doesn’t remember the GUID of each record in CRM, then he can skip all of the steps and proceed to the table structure steps at the end of the Post, just kidding!
We want all this numbers and alphabets to be more user friendly, or with simple word we want to see the Names.
We need first to initialize so called variables, variables store information, or values, in a program. There are different types of variables that are used in different situations: strings, integers, and arrays.
Strings are groups of characters, like words or phrases, and integers are whole numbers, like 5, 50, or 500. But what if we want to store multiple values in a variable? The solution is an Array!
Now, we need to get the list of all Leads in CRM, but since they will be quite a lot, we need to filter them somehow, and this is where we will use our Past Time that we've set early.
So basically we are using formatDateTime with Body function which refers to the trigger action (Get-Past_time) followed by the date format.
Next steps is actually the core of the flow and it is the most important one if you want to make the flow working!
First we need to specify the related entities for each lookup that we want to display.
This is how the configuration looks like for one of this Lookup fields.
I know this might look a little more technical, but it is important to get the logic, once you get it you will build more complex flows in no time.
Here I'm typing the name of the Filed that will be displayed in the Email and then which filed stored the information that will be displayed.
For example: I've already mapped for the Lead that Parent Account for Lead is actually the Account Name, so the same mapping is set in the table as well.
Remember: the table will display the information from the related entities and not directly from the Lead entity as the fields there are referring only to GUID of the record but not the display name.
Or other way said, if we've collected a GUID for a Parent Account for Lead we now know which entity will tells us the Display Name behind that GUID, and this is Account Name (on Account Entity).
Before: (this is from List Lead Record Action)
After: (this is after the GUID are matched with the mapped fields)
Last but not least, we need to add Send email function, which will send the HTML table in an email to us.
I'm using Gmail integration with MS Flow, but you can set it with your Outlook one (which is the most common setup).
In the email body I have greetings and inside I've inserted the Output from the HTML table step.
The end result is this.
Thank you and looking forward for any ideas to develope this further in the future.
Business Applications communities