web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Trigger Condition not ...
Power Automate
Unanswered

Trigger Condition not working

(0) ShareShare
ReportReport
Posted on by 85
Hi everyone,
 
I am building a flow with a trigger condition that must meet two conditions before it runs from a SharePoint list but it's not working for me!  Any help would be much appreciated.
 
It should only equal one of the 3 offices (choice field) AND where the start date field is blank (date field).
 
@and(or(equals(triggerOutputs()?['body/BusinessArea']?['Value'], 'London'), equals(triggerOutputs()?['body/BusinessArea']?['Value'], 'Leeds'), equals(triggerOutputs()?['body/BusinessArea']?['Value'], 'Manchester')), equals(triggerOutputs()?['body/ConfirmedStartDate'], null))
Thanks in advance
 
C
Categories:
I have the same question (0)
  • Suggested answer
    rzaneti Profile Picture
    4,241 Super User 2025 Season 2 on at
    Hi,
     
    Whenever you are adding a new item without the 'ConfirmedStartDate' field filled (assuming that you are working with a "When an item is created" trigger), its value won't actually be null: SharePoint will simply not return this property to Power Automate. Because of this behavior, Power Automate tests if the 'ConfirmedStartDate' is equal to null and, as it doesn't find this property within the triggerOutputs()?['body'] (not found is different from null), the condition returns as false and your flow is not executed.
     
    Having said that, I ran some tests from my end and found that you can make it work by using the following trigger condition: 
     
    @and(or(equals(triggerOutputs()?['body/BusinessArea']?['Value'], 'London'), equals(triggerOutputs()?['body/BusinessArea']?['Value'], 'Leeds'), equals(triggerOutputs()?['body/BusinessArea']?['Value'], 'Manchester')), not(contains(triggerOutputs()?['body'], 'ConfirmedStartDate')))
     
    Here we are just asking PA to test if the trigger body does not contains the property 'ConfirmedStartDate', so the flow will run only if this property is not found, which is the case when the date is empty. 
     
    Let me know if it works for you or if you need any additional help!
    -------------------------------------------------------------------------
    If this is the answer for your question, please mark the post as Solved.
    If this answer helps you in any way, please give it a like.
  • smodkins Profile Picture
    85 on at
    Thank you for replying! I am not sure now on my logic here...
     
    I changed the trigger to condition to what you suggested and on my test record I removed the date I already had in confirmed start date and it ran but failed as there was no value in ConfirmedStartDate.  I then added the confirmed start date back in and it didn't trigger....
     
    What I want to happen on this onboarding tracker is for this flow to trigger when it's one of those offices and a confirmed start date is added.
     
    I don't want it to trigger when a confirmed start date is changed from an existing value to a new value or if the confirmed start date is removed.
     
    Appreciate any help you can offer :)
  • rzaneti Profile Picture
    4,241 Super User 2025 Season 2 on at
    Hi,
     
    The provided condition is capturing changes only when the new item value is empty, similarly to the condition shared by you in the first post of this thread. These conditions are evaluated after the item modification, so if your record had a value before and you removed it in this change, the event will be captured by PA. However, if your column was empty and you assigned a value to it, this event will be ignored. 
     
    Based on your last message, the only scenario that you want to capture is whenever the Confirmed Start Date of a record is modified from "blank" to some valid value. Is this correct?
     
    If it is, you have the option to work with some HTTP requests to capture the previous List record values and compare them to the existing one, so you can compare if the Confirmed Start Date was blank before or not. This option can be a little complex, but won't require any changes in your current List design.
     
    Another option is to add a calculated column to your SP List of yes/no type, with a formula to be filled as yes only when Confirmed Start Date is not blank. With this logic, your column will change only once: whenever the Confirmed Start Date changes from blank to any valid value. In PA, you would be able to track the columns that changed with Get changes for an item and file (properties only), and since this yes/no column is automatically changed only when a date is assigned, you will simply need to track if the yes/no property changed. You can see an example of this action's outputs below: 
     
     
     
    Let me know which of the options above fits best to your need (HTTP request without changing the table structure, or new column with a simpler flow design), and I will be happy to provide you with a step-by-step. 
     
    Let me know if it works for you or if you need any additional help!
    -------------------------------------------------------------------------
    If this is the answer for your question, please mark the post as Solved.
    If this answer helps you in any way, please give it a like.
  • smodkins Profile Picture
    85 on at
    Hi rzaneti,
     
    Thank you for coming back to me.  
     
    Based on your last message, the only scenario that you want to capture is whenever the Confirmed Start Date of a record is modified from "blank" to some valid value. Is this correct?
    Exactly this! 
     
    Another option is to add a calculated column to your SP List of yes/no type, with a formula to be filled as yes only when Confirmed Start Date is not blank. With this logic, your column will change only once: whenever the Confirmed Start Date changes from blank to any valid value. In PA, you would be able to track the columns that changed with Get changes for an item and file (properties only), and since this yes/no column is automatically changed only when a date is assigned, you will simply need to track if the yes/no property changed. 
    I think the issue with this approach is I was also hoping to expand on it in the future where if the confirmed start date changes value from one date to another that it triggers a different flow informing a series of users such as line manager etc that the start date has changed so this approach would not work for that right?
     
    Happy to work with any suggestions you have
     
    Thanks
    C
     
  • rzaneti Profile Picture
    4,241 Super User 2025 Season 2 on at
    Hi smodkins,
     
    In this case, the HTTP request is the best path! Tomorrow I won't have so much time, but give me until Friday and I will be back here with a step-by-step on how to implement it in your flow. 
  • Verified answer
    rzaneti Profile Picture
    4,241 Super User 2025 Season 2 on at
    Hi smodkins,
     
    I have all set :)
     
    I had to work with some assumptions for this tutorial, so if something doesn't match exactly to your use case, let me know and I will be happy in provide you with further support. 
     
    Knowledge base
    Before we get started, I will share the link for some blog posts that I wrote about the topics discussed here. It can be useful for you or for any other user that finds this thread in the future.
    - How to work with Power Automate expressions: http://digitalmill.net/2024/02/27/writing-expressions-in-power-automate/
     
    List overview
    For this step-by-step, I'm working with the following SP List:
     
    Similarly to yours, it has a Office column (choice data type) and a ConfirmedStartDate column (date only). 
     
    Starting the flow: trigger and conditions
    Here I'm working with a When an item or a file is modified trigger, which capture only the updates in your SP List (and not the insertion of new items). Based on your previous posts in this thread, the flow must be triggered only when a date is assigned to a List Item, and its previous value is blank, so we don't need to capture the creation of new items:
     
    As a trigger condition, I'm using @and(or(equals(triggerOutputs()?['body/Office']?['Value'], 'London'), equals(triggerOutputs()?['body/Office']?['Value'], 'Leeds'), equals(triggerOutputs()?['body/Office']?['Value'], 'Manchester')), contains(triggerOutputs()?['body'], 'ConfirmedStartDate')), which is the same recommended in my first message, but without the not. This condition will capture only changes in items where Office is set as Leeds, London or Manchester, and the ConfirmedStartDate is not blank (after the modification). 
     
    If you are copying the condition from this step-by-step, make sure to change the "Office" column name. 
     
    Get all item versions
    For this solution, we will need to access all previous versions from the List Item, so we can compare the new one with the existing before the change. For that, we will use a HTTP request like below:
     
     
    About the request:
    - Make sure to set the Site Address as the same where your List is located.
    - Set the method to GET.
    - Use the following URI: _api/web/lists/getbytitle('Employee onboarding')/items([ID_dynamic_content])/versions/, replacing the text in red for your List name and the text in blue for the trigger's ID dynamic content.
    - Add the header accept with the value as application/json.
     
    This HTTP request will return a history of all values that your List Item ever had in its previous versions. For example, when running the flow for a modification in the "Spiderr man" record from the List, the HTTP outputs will include all values from its previous versions, including the 2.0, when the ConfirmedStartDate was blank (null):
     
     
    Getting the ConfirmedStartDate from previous version
    A good thing from this HTTP request is that it retrieves all versions as an array of objects in descending order by modification date, so you will have the current version (the just changed one) as first element, the previous version (the one from where we want to capture the ConfirmedStartDate to test if it's empty) as second element, and so on. 
     
    Having said that, we are sure that the previous version will always be allocated at the second position in the array, so we don't need to waste time comparing the different versions to identify which one is the correct. 
     
    So let's extract the form the second array element and store it into a variable. You can use the expression 
    outputs('Send_an_HTTP_request_to_SharePoint_-_All_versions')?['body']['value'][1]['ConfirmedStartDate'] for that:
     
    When copying/pasting the expression, make sure to replace outputs('Send_an_HTTP_request_to_SharePoint_-_All_versions')?['body'] for the dynamic content of the body property of your HTTP request action.
     
    Test if ConfirmedStartDate in previous version is blank
    Finally, let's test if the ConfirmedStartDate before the Item modification is blank. For that, you will need to add a condition, and set the left input as an empty expression, such as empty(variables('previous_date_value')) (make sure to use your actual variable dynamic content within the empty parentheses), keep the dropdown as is equal to and set the right input as true:
     
    The rest of your flow must now be positioned within the If yes block, since it will be executed only if the previous date was blank.
     
    Testing the flow
    I just added a new record to the List, allocated to one of the Offices that must be captured by the flow. This event, however, won't trigger the flow, since we are monitoring only modifications and not item creations: 
     
    Now let's make a small change in the name (but not in the date), which will update the Item version to 2.0, but still won't trigger the flow, since the ConfirmedStartDate is still empty:
     
    Then we will make another change (going to version 3.0), and at this time setting the date: 
     
     
    At this time, the flow finally ran, since we match both trigger conditions (Office is Leeds/London/Manchester and ConfirmedStartDate is not empty). As expected, the Condition returned as true, since the ConfirmedStartDate for version 2.0 was empty:
     
     
    If we now make any other change to the same Item, the flow will still run, but the condition will return as false, as the previous version doesn't have the ConfirmedStartDate as empty:
     
     
    Let me know if it works for you or if you need any additional help!
    -------------------------------------------------------------------------
    If this is the answer for your question, please mark the post as Solved.
    If this answer helps you in any way, please give it a like.
  • smodkins Profile Picture
    85 on at
     Hi rzanetic
     
    Sorry I didn't get to look at your response until today.  I failed at the Send HTTP request but I missed the _ in front of the api so that step is now successful
     
    The next step of initialize variable keeps failing with the error:
     
    Action 'Initialize_variable_2' failed: Unable to process template language expressions in action 'Initialize_variable_2' inputs at line '0' and column '0': 'The template language expression 'outputs('Send_an_HTTP_request_to_SharePoint')?['body']['value'][1]['ConfirmedStartDate']' cannot be evaluated because property 'value' doesn't exist, available properties are 'd'. Please see https://aka.ms/logicexpressions for usage details.'.
     
     I did as you said with replacing the outputs('Send_an_HTTP_request_to_SharePoint_-_All_versions')?['body'] with the dynamic content
     
    Thanks
    C
  • rzaneti Profile Picture
    4,241 Super User 2025 Season 2 on at
    Hi @smodkins,
     
    Did you include the "accept": "application/json" in the headers of your Send an HTTP Request action? This error usually happens when you miss this header. 
     
    If you did include it, can you please share an image of your Send an HTTP Request action inputs, and the raw outputs from it? If you don't know how to access the raw outputs, refer to this tutorial
  • smodkins Profile Picture
    85 on at
    Hi @rzaneti,
     
    You sir are a genius! Thank you for you help!
     
    I did have the "accept": "application/json" in but when I copied and pasted from here the accept had a rogue space after it! 
     
    My last question to you, would you incorporate a change in start date within the same flow or in a separate flow with a similar action and how would we go about this?
     
    Thanks
    smods
  • rzaneti Profile Picture
    4,241 Super User 2025 Season 2 on at
    Hi @smodkins,
     
    I'm glad to hear that it's working fine! About your question, if your idea is to have a simple process for the changes in the existing start date, you can integrate it into this same flow, by simply allocating another Condition the If no block. In this new Condition, you must test if the start date from the trigger is not equal to the  previous_date_value variable, and allocate your logic withing the If yes block:
     
     
     
    If your process for the changes in the existing start dates is complex or longer than a few steps, I would recommend you to clone the flow and change the condition for capturing the difference between the current and previous values for the column. 
     
    Let me know if it works for you or if you need any additional help!
    -------------------------------------------------------------------------
    If this is the answer for your question, please mark the post as Solved.
    If this answer helps you in any way, please give it a like.
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard