cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tinalamkey
Helper I
Helper I

Share Attachments via email when you change Project Status column to Complete.

I have created a flow that when an item is created or modified, it sends the attachments via email to our finance team. BUT I only want it to do that process when the project information in the entry is complete (or marked as complete) not EVERY TIME we modify the entry information.  Does anyone know how to do this? 

 

Current List:

Capture.JPG

 

Current Flow: 

Capture2.JPG

1 ACCEPTED SOLUTION

Accepted Solutions
CraigStewart
Super User
Super User

It's the condition

CraigStewart_0-1654184324737.png

 

It looks like you're checking to see if the status column has a value of 'true' - I assume that is "PKO Statue Value"

 

but what you want to be checking is the "Has column changed"

 

CraigStewart_2-1654184588673.png

 

 

 

 

 

View solution in original post

17 REPLIES 17
CraigStewart
Super User
Super User

Hi

 

If you go into settings (...) on your trigger then add a trigger condition at the bottom of there

@equals(triggerBody()?['COLUMNNAME']?['Value'], 'Complete')

 

That should trigger only when your column is set to complete.

 

 

Thanks, Craig - Should the code look like this: @equals(triggerBody()?['PKO Status']?['Value'], 'Complete'  - I just got an 'invalid expression' error....

CraigStewart
Super User
Super User

Sorry need a closing bracket on that 

@equals(triggerBody()?['Status']?['Value'], 'Complete')

Unfortunately, when I test it, it just spins for a long time and nothing is happening.  It then times out.

tinalamkey_0-1654177637957.png

 

CraigStewart
Super User
Super User

Hi 

 

Check your column name in SharePoint, it's likely to be PKOStatus without the space.

 

You can double check that by ordering your sharepoint like Z to A with that column and check in the browser for the name in the url after &sortField=

Ok!  This is working - Column was named 'status' .  FINAL question (I think).  If a column is marked complete and I edit a different column, it is still sending off an email.  Is there a way for it to send an email when JUST the Status column is changed, but when other columns are changed, it does not send an email?

CraigStewart
Super User
Super User

Ah ok, so you're making changes after the status is amended.
You can add a condition to check for changes

Add  the Get Changes for an item or file action as below

You should be able to select the start and end tokens, if not the expressions are here

triggerOutputs()?['body/{TriggerWindowStartToken}']

triggerOutputs()?['body/{TriggerWindowEndToken}']

 

 

CraigStewart_1-1654179818851.png

 

In your condition you can select which fields you want to target, in your case 'status'

CraigStewart_2-1654180124380.png

 

So your condition will be 

Has column changed: Status 

is equal to

true

 

Then add the rest of your flow inside the yes section.

 

When you change another field while the column is set to complete the flow will still trigger, but if it's any other field it should flow down the NO path.

 

Inside No I would add a Terminate action and set it to cancelled so I could see the runs that irrelevant more easily.

 

 

Starting to get it set-up.  Under "yes" it's not allowing me to choose 'initialize variable' - only allowing Append to array variable and then not sure what to plug-in.  

tinalamkey_0-1654181100425.png

I am trying to do an Attachement Array.

tinalamkey_1-1654181176447.png

 

 

CraigStewart
Super User
Super User

You need to initialise the variable at the top level before the condition. What is this variable?

 

You'd use append to variable if you were looking to add data to it.

I feel like I am really close!  Something is occurring at the condition when I test it. 

 

Capture_1.pngCapture_2.png

CraigStewart
Super User
Super User

In your history on this flow - your condition will be returning 'false' so it's going down the No option - is that ticked green and the flow marked as cancelled

 

Was the flow run expected to NOT send the email?

 

If so then it's working and those skips are normal.

 

If it was expected to produce a result and send the email then something is up with the condition.

 

Unfortunately your large image of the flow is not clear for me, and it also seems to have some bits cut out - like what the terminate action is doing.

First off, THANK YOU - you have been so helpful.  The flow was supposed to produce an email - it was an automatic test.  I just did a manual one and that did not work also (it's just spinning).

Here are some better screenshots:

tinalamkey_0-1654183911425.png

tinalamkey_1-1654183934259.png

tinalamkey_2-1654183954683.png

 

CraigStewart
Super User
Super User

It's the condition

CraigStewart_0-1654184324737.png

 

It looks like you're checking to see if the status column has a value of 'true' - I assume that is "PKO Statue Value"

 

but what you want to be checking is the "Has column changed"

 

CraigStewart_2-1654184588673.png

 

 

 

 

 

tinalamkey
Helper I
Helper I

Thank you, Craig!  So excited this is working!

CraigStewart
Super User
Super User

Great stuff. Enjoy your flow 🙂

Hi, Craig.  Have an issue - attachments 'cannot be previewed and are corrupt.  Any chance you can assist?

tinalamkey_0-1654708488059.png

 

I think it might have to do with the 'body' option - throughout the flow it shows up in multiple places and it always gives me three options for 'body':

tinalamkey_1-1654708572400.png

 

 

 

Looks like the screenshots are too small.  

 

tinalamkey_2-1654708774604.png

tinalamkey_3-1654708789747.png

tinalamkey_4-1654708850356.png

tinalamkey_5-1654708868443.png

 

tinalamkey_6-1654708882936.png

 

 

 

 

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,813)