Send an email to users in a D365 Team Individually using power automate (without using a distribution list)
D365 gives us a functionality to assign a record to a group of users which can be archived by using a D365 Team these users then are know as members of that respective team, due to functionality restrictions we cannot send an email to a D365 team, however there are a few workarounds by which we can achieve this functionality.
Lets consider a very case.
Suppose we have a D365 team called as “Accounts Associates” we have added a set of users in this team. Now if an invoice milestone is in the ready state i.e. “Ready For Invoicing” we need to send a reminder email to this “Accounts Associates” team to take an action regarding the ready invoicing
Solution :-
The following case can be achieved by Looping through all the users in of a D365 Team.
Lets Begin with the Implementation.
Step 1 – Create a D365 Team.
Go to Security – > Teams -> Create a new team.
Step 2 – Create a Flow to send email.
1. Flow triggers when Project Contract Line is Updated, Condition Invoice Milestone is Ready for invoicing for which click on the “…” select settings and add the following condition in the trigger section.
![Concurrency Control
Limit number of concurrent runs of the flow, or leave it off to run as many as possible at the same time.
Concurrency control changes the way new runs are queued. It cannot be undone once enabled.
Off
Limit
Trigger Conditions
Specify one or more expressions which must be true for the trigger to fire.
@equals(triggerBody()?[imsdyn_invoicestatus•l.192350001)
Add
x](https://www.cloudfronts.com/wp-content/uploads/2021/02/image-156.png)
2.Get the Teams ID in this case I have hardcoded the ID as no record was associated with it to retrieve it
3.Get the Teams Details.
4.Get the User Details by using the following fetch XML Query.
![Email to team Owner
p Search for helpful resources
When a Project Contract Line Milestone is Updated
Home
Action items
My flows
Create
Templates
Connectors
Monitor
Al Builder
Process advisor
(preview)
Solutions
Learn
CFS Production
Save Flow checker
Copy to my clipboard (Preview)
Rename
Add a comment
Static result (Preview)
Settings
Configure run after
Peek code
Delete
My connections
admin@DataFrontsDemo.onmicrosoft.com
*Add new connection
Test
Trigger condition
'The table name
Scope
Show advanced options
{x}
Team ID
Name
Type
Value
Update
Project Contract Line Milestones
Organization
Team ID
String
8C4D642F-625C-EB 1 1 -AB 12-OOOD3A8C6500
Get Account Teams
o
• Table name
Item ID
Teams
Team ID X](https://www.cloudfronts.com/wp-content/uploads/2021/02/image-157-1024x485.png)
5. Query :
<fetch version=”1.0″ output-format=”xml-platform” mapping=”logical” distinct=”true”>
<entity name=”systemuser”>
<attribute name=”fullname” />
<attribute name=”businessunitid” />
<attribute name=”title” />
<attribute name=”address1_telephone1″ />
<attribute name=”positionid” />
<attribute name=”systemuserid” />
<attribute name=”internalemailaddress” />
<order attribute=”fullname” descending=”false” />
<filter type=”and”>
<condition attribute=”internalemailaddress” operator=”not-null” />
</filter>
<link-entity name=”teammembership” from=”systemuserid” to=”systemuserid” visible=”false” intersect=”true”>
<link-entity name=”team” from=”teamid” to=”teamid” alias=”ag”>
<filter type=”and”>
<condition attribute=”teamid” operator=”eq” uitype=”team” value=”{Your Team ID}” />
</filter>
</link-entity>
</link-entity>
</entity>
</fetch>
![Get User Details
• Table name
Select Query
Filter Query
order By
Expand Query
users
Limit the properties returned while retrieving data.
An ODATA filter query to restrict the entries returned (e.g. stringcolumn eq 'tri
An ODATA orderBy query for specifying the order of entries.
Related entries to include with requested entries (default = none).](https://www.cloudfronts.com/wp-content/uploads/2021/02/image-158.png)
![](https://www.cloudfronts.com/wp-content/uploads/2021/03/Fetch-XML-body.png)
For all the users Send an Email individually to the user
![For all users in the team
*Select an ou tfrom reviousste s
value x
Send an email to the user indivisually
To
• Subject
• Body
Show advanced options
Primary Email x
Inv'0ice Milestone Ready for Invoicing
Font
12
Team N ame x Team,
An invoice milestone is ready for invOCing, Please take the necessary actions.
Thanks,
This is a system generated Email.](https://www.cloudfronts.com/wp-content/uploads/2021/02/image-159.png)
Output
User 1. Which is CRM Admin in my case in the team.
![](https://www.cloudfronts.com/wp-content/uploads/2021/03/Email-1.png)
User 2 Vidit Gholam system Administrator
![](https://www.cloudfronts.com/wp-content/uploads/2021/03/Email-2.png)
![Move to v Categorize @ Snooze v
Invoice Milestone Ready for Invoicing
G) This message was sent with Low importance
Vidit Gholam
Thu 2/2512021 1:35 PM
To: Vidit Gholam
Hi Account Associate Team,
• ) Undo
CloudFronts
VG
Sign out
Vidit Gholam
admin@DataFrontsDemo.on...
View account
Open another mailbox
An invoice milestone is ready for invocing, Please take the necessary actions.
Thanks,
This is a system generated Email.
Reply
Forward](https://www.cloudfronts.com/wp-content/uploads/2021/02/image-162-1024x585.png)
Hope that helps. !