cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

power automate trigger conditions on modifying field

Hello All, i have a case where i want to trigger my flow "when an item is modified (V2)" SQL action , when the field "WORKFLOWSTATUS" modify as value 4.

I tried using this expression 

 

 

@equals(triggerOutputs()?['body/WORKFLOWSTATUS'],4)

 

 

after filed value become 4 and then there is any change in any field , flow trigger again since expressions checks for equal , but i want to trigger flow on modifying fled with a particular value 4 , Please advise  

SachinG31_0-1654414541095.png

2.

SachinG31_0-1654434570229.png

3.

SachinG31_1-1654434762039.png

 

 

 

 

14 REPLIES 14

Remove that last comma, @SachinG31 :-).

@equals(triggerOutputs()?['body/WORKFLOWSTATUS'],4)

That should do the trick.

Hello @eliotcole , thanks for looking into this , i dont have comma in my trigeer settings if you  will see the screen shot attached . in the text it pasted by misteak 😞

Ah, OK, my bad.

 

Would you mind editing your original question with a couple of things?

  1. Change that formula 😅😉 ...
  2. Paste a screenshot of the input when there is no Trigger Condition so that we can see what the input for the WORKFLOWSTATUS field looks like?

Just obfuscate (blank out) any sensitive information.

 

My suspicion is that the field that you are looking at is either:

  • A string, so looking for the number value won't work.

    or

  • A floating point number (4.0) which may not match either. This should still match if it is 4.0 based on a very simple test I just did.

If it's the string thing, then try this:

@equals(triggerOutputs()?['body/WORKFLOWSTATUS'],'4')

... or this:

@equals(triggerOutputs()?['body/WORKFLOWSTATUS'],'4.0')

or any number of zeros afterward.

Yeh Sure Buddy,

 

i have corrected the formula in question already 

the data type in SQL field WORKFLOWSTATUS is int

 

Required screen shot pasted here

i hope these details are enough


The issue is not with reading the condition. Flow is obaying the condition and does needful when status updated as 4.

but after status become 4, when changes made in any other column flow triggers again since it is satifying the trigger condition.

i need some formula which will applied on WORKFLOWSTATUS field modification , not on equal. 

 

That's great, @SachinG31, cheers. 👍

 

I'm not sure if I can help, but stick that image in to the original question just to help someone cleverer than me! 😅

Done as advised , appriciate your time 🙂

v-yujincui-msft
Community Support
Community Support

@SachinG31 ,

 

Maybe you could try to add another status column in your data source.

vyujincuimsft_0-1654594997602.png

Then Change the Trigger Conditions as follows:

@and(equals(triggerOutputs()?['body/WORKFLOWSTATUS'],4),equals(triggerOutputs()?['body/OffOn'],'On'))

If the flow is triggered, you could try to change the value of this column to Off. The Flow should not be triggered the next time you change other columns of this record.

vyujincuimsft_3-1654595403462.png

In addition, here is a link that might help you:

https://tomriha.com/how-to-trigger-power-automate-flow-on-specific-sharepoint-column-update/

 

Best Regards,
Charlie Choi

Hello @v-yujincui-msft , Thanks for the advise. i am applying this solution but i am getting error in update row action.

SachinG31_0-1654668848919.png

I am using a view and Row ID is a column RECID, which is unique and primary key. 

SachinG31_1-1654669009828.png

SachinG31_2-1654669041533.png

Please advise 

 

 

Hi @SachinG31 ,

 

Maybe you could try to create a new connection and try it again.

vyujincuimsft_0-1654746315062.png

 

 

Best Regards,
Charlie Choi

I have an idea, @SachinG31, since your conversation with @v-yujincui-msft you mentioned that you are able to add columns to the SQL.

If SQL is able to recognise versioning of records, then you could use a computed column to add a copy of the previous version of the column to this one. So oldNew ... 34, or 44, or 45.

( you may be able to tell, I'm StartPage-ing all my SQL knowledge right now! )

Waitaminute. This is simple, 's answer should work for you, but if you get the trigger correct on this flow, then you should be OK.

Prep

So, up front do a bit of preparation which involves adding 2(!) columns to the SQL:

  1. oldWrkFlwStatus - An integer field to store the previous value.

  2. Now copy the ENTIRE db's records' values of WORKFLOWSTATUS into the new oldWrkFlwStatus column.

  3. wrkFlwStChanged - Computed column which returns YES or true if WORKFLOWSTATUS and oldWrkFlwStatus do NOT match.
    So this should currently reading NO or false for all records.

So what you've done here, is instead of changing the change monitoring column with flow,  instead the database is monitoring the change. This means that when any flow is triggered it can check this computed column.


The Flow

Everything here should just be able to be pasted in to the relevant input field, if you have issues, reply with screenshots of the flow before it is run:

  1. Add a trigger condition:
    @equals(triggerOutputs()?['body/wrkFlwStChanged'],TRUEVALUE)
    Ensure TRUEVALUE is entered correctly (see notes after this list).

  2. The FIRST action in the flow is a Switch action, here's a rough idea of what that will look like with the On field containing the WORKFLOWSTATUS value:
    @{triggerOutputs()?['body/WORKFLOWSTATUS']}
    kinda-ish.jpg

    1. In the first Case, enter 4 as the equals, then add a Update row (V2) action to modify the oldWrkFlwStatus to @{triggerOutputs()?['body/WORKFLOWSTATUS']}
    2. In the Default case add 2 actions:
      1. Update row (V2) action first to modify the oldWrkFlwStatus to @{triggerOutputs()?['body/WORKFLOWSTATUS']}
      2. Terminate action set to 'Success'

Remember that I've used TRUEVALUE as a placeholder in the Trigger Condition, here. It will need to be whatever your computed column outputs when there's a change. For example if that is a string value of YES, you would place 'YES' there (quotes included).

 

Now the rest of your flow can continue as per normal, and you can add your email action that you wanted to add. It will only fire on Status = 4, and this flow will double up as a way to action other potential Status changes in the future.

 

That *computed* column is the key, here, though.

Hello @v-yujincui-msft , I tried creating connection multiple times . still the error is same. This is On premise SQL server , do we have some limitation with that?

Hello @eliotcole , Thank you so much for all the efforts and providing such a detailed solution. I am sure this will definitely work , but in my case i am unable to Apply this because of these limitations.

 

1.i can not ad new column in table , since the table is from D365 F&O ERP, and its not recommended to do any change on SQL level. That's why i was re using  a column "APPROVRLDATETIMEZID", As a update flag.

2.i dont know but update row V2 action is not working in my flow , it shows primary key error (Explained above) , even if there is primary key 

 

Well, that's a shame, @SachinG31, as you may have guessed, I'm not too experienced with SQL, so this is possibly where my help could end.

 

One possibility that I have for you is:

How big is the SQL DB/table?
and

How much 'new' traffic does it get?

 

Because if it is small, and relatively low traffic, then the limits on SharePoint lists are HUGE these days, and you could simply make a duplicate list in SharePoint to handle the information that you want to handle. I'm not going to go into THAT (because it would be too complex for right now) but feasibly you could mirror new/modified values to SharePoint, then make the columns that you need (as per my SQL suggestion, previously) then run a 'new/modified' on the SharePoint list.

 

Could that be an option?

 

Hello @eliotcole , Sorry for late revert. I have acheived this as workaround. i added a Share point create item action when i am storing my form number and i marked form number as unique field. 

so ay first attempt of approval it run and store data in SP list , on second attempt it gets fail as the formNumber column can not be duplicated. 

So far it is working fine as per my need. thats how flow looks now 

SachinG31_0-1656850398935.png

 

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!    This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24  17 @Anil_g  7 @ManishSolanki  13 @eetuRobo  5 @David_MA  10 @VishnuReddy1997  5 @SpongYe  9JhonatanOB19932 (tie) @Nived_Nambiar  8 @maltie  2 (tie)   @PA-Noob  2 (tie)   @LukeMcG  2 (tie)   @tgut03  2 (tie)       Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate  @Deenuji  12@ManishSolanki 19 @Anil_g  10 @NathanAlvares24  17 @VishnuReddy1997  6 @Expiscornovus  10 @Tjan  5 @Nived_Nambiar  10 @eetuRobo  3 @SudeepGhatakNZ 8     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22   Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2   Anil_g2   SharonS2  

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages