Update Change Log and Send E-mail to Stakeholdes when
Product Status Changes
A Power Automate tutorial by Peter Kalmström
In
the demo below Peter Kalmström, CEO and Systems Designer
of kalmstrom.com Business Solutions, builds a flow that
sends an e-mail notification to stakeholders when the status
value in a product development process is changed. The flow
is connected to two lists:
- The Product Statuses list contains the different
status steps in the development process and gives a
description of each step.
- The Products list takes the Status and Description
values for from the Product Statuses list. This
list also has a "Stakeholders" column.
When the status for a project is changed, the flow will
send an e-mail with the new status and its description to
the stakeholder(s). In the final flow, there will also be
a Change log update.
Peter first creates a flow with just one stakeholder, and
then he modifies that flow to work even if there are multiple
stakeholders. These people will then get individual e-mails
with the new status and its description.
He also adds another column in the Products list:
Change log. This is a Multiple lines of text column, where
Append changes to existing text is enabled. Here, you can
see who changed the status value, and when.
Flow for One Stakeholder
Trigger
The flows is an automated blank flow that uses the trigger
'SharePoint - when an item is created or modified
for the Projects list.
Flow actions
- SharePoint – Get changes for an item or a file.
- Control - Condition to only send the e-mail
if the "Status" column has been changed. As this flow
updates the same list as in the trigger, it might cause
an infinite loop. That is avioded with the condition,
but Power Automate will still give a warning.
- Office 365 Outlook - Send an email (V2).
If the condition is true, an e-mail with information
about the new step is sent to the stakeholder.
Flow for Multiple Stakeholders
When there are multiple stakeholders and a change log, two
more actions must be added:
- Control - Apply to each loops through the
stakeholders and adds one e-mail address in the 'To'
field of the 'Send an email (V2)' action for each loop.
- SharePoint – Update item, to add change info
to the "Change log" column.
Peter does not want to send an e-mail with multiple receivers.
Instead, he adds a loop before the e-mail action and moves
the e-mail action into the loop.
The e-mail receiver should no longer be taken from the trigger
but from the 'Apply to each' action, so Peter deletes the
Stakeholder dynamic content from the 'Send an email (V2)'
action. Instead, he adds the expression items('Apply_to_Each').Email
in the 'To' field.
The 'Update item' action can be added after the e-mail action
if all items in the Products list have stakeholders.
In that case, e-mails will always be sent at status modifications,
and then the "Change log" column gets updated.
In case there can be items that don't have stakeholders,
it is better to add the 'Update item' action before the
'Apply to each', so that the "Change log" column gets updated
anyway.
|
 |
 |
|