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:
Current Flow:
Solved! Go to Solution.
It's the condition
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"
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....
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.
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?
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}']
In your condition you can select which fields you want to target, in your case 'status'
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.
I am trying to do an Attachement Array.
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.
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:
It's the condition
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"
Thank you, Craig! So excited this is working!
Great stuff. Enjoy your flow 🙂
Hi, Craig. Have an issue - attachments 'cannot be previewed and are corrupt. Any chance you can assist?
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':
Looks like the screenshots are too small.
User | Count |
---|---|
100 | |
36 | |
29 | |
24 | |
16 |
User | Count |
---|---|
132 | |
54 | |
53 | |
37 | |
26 |