Business requirement:
Email notification to be sent to all the Queue Members on assigning a Case to Queue.
Solution:
1. Add a step “When a row is added, modified or deleted” then rename it to “Trigger when a Queue item is created” and enter the following details:
Change Type: Added
Table Name: Queue Items
Scope: Organization
2. Add an action “Get a row by ID” and rename it as “GetCaseDetails” – This step is used to get a case record details:
Table Name: Cases
Row ID: Object (Value)
3. Add an action “Initialize Variable” and rename it to “Get all the emails of Queue Members” – This is used to store emails of all the queue members
Name: Queue Members Email
Type: String
4. Add an action “Initialize Variable” and rename it to “Record URL” – This is used to store the URL of Case record
Name: Case Record URL
Type: String
5. Add a condition to ensure when the type of record is case or not.
6. Under “Yes” part of a condition, add an action “List all records” and rename it to “List all members and their emails” – This is used to get all the users (Members) and their emails which we’ll use later. We may first need to fetch XML query.
Table Name: Users
Fetch XML Query:
<fetch version=”1.0″ output-format=”xml-platform” mapping=”logical” distinct=”true”>
<entity name=”systemuser”>
<attribute name=”fullname” />
<attribute name=”systemuserid” />
<attribute name=”internalemailaddress” />
<order attribute=”fullname” descending=”false” />
<link-entity name=”queuemembership” from=”systemuserid” to=”systemuserid” visible=”false” intersect=”true”>
<link-entity name=”queue” from=”queueid” to=”queueid” alias=”ad”>
<filter type=”and”>
<condition attribute=”queueid” operator=”eq” uiname=”Queue Name” uitype=”queue” value=”{@{triggerOutputs()?[‘body/_queueid_value’]}}” />
</filter>
</link-entity>
</link-entity>
</entity>
</fetch>
7. Add an action “Apply to each” and select the “Value” which we are getting from previous step (List all Records) then add an action “Append to String Variable”
under Apply to each and enter following details:
Name: Select “Queue Member Email” variable
Value: Add following expression
concat(items(‘Apply_to_each’)?[‘internalemailaddress’],’;’)
8. Add an action “Send an email (V2)” and enter the required details:
To: Queue Members Email
9. Save the flow and test it.
Hope it helps and Power 365ing as usual!
Other ways to learn with me:
Any problem in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual?
Problem Area – Technical, Functional, Training, Development or consulting?
Me and my team are here to help, get in touch here: Click here