I have two fields named as Status and Approved.
In my form when approver selects the option either approved or reject, the result will get save in the approved field.
Now I want to change the status field also as per the result save in the approved field to Approved or Rejected.
I tried this by using update item action in power automate flow and it is not working. It is calling the same thing in a loop. It is also showing warning that this action will trigger an infinite loop.
Can anyone please suggest me any solution with this action in flow.
You can add trigger conditions to your flow so that it will only fire when a specific set of conditions are met.
This is a basic example that you can try and incorporate into your own flow.
My list has two specific fields, Field1 and Field2. As per your trigger, when an item is created or modified, I only want to trigger the flow when those two fields are not equal and if they're not, the flow will update Field2 with the value from Field1.
This removes the recursive nature of the flow as it will do the check prior to actually executing.
My expression for the trigger is shown below ...
... and that setting can be found in the settings of the trigger ...
Related
I am trying to resolve this error in Power Automate:
Actions in this flow may result in an infinite trigger loop.
Please ensure you add appropriate conditional checks to prevent this flow from triggering itself.
This seems to be a common problem when using this trigger:
When an item is created or modified
where the associated flow contains this action:
Update item
The dynamic is succinctly explained in these videos here and here.
Desired Behaviour
The desired behaviour is that the flow:
Runs when a list item is created or modified by a user (and updates the item accordingly)
But not when the flow itself updates the item
Actual Behaviour
The actual behaviour is that the flow:
Runs when a list item is created or modified by a user (and updates the item accordingly)
Also runs when the flow itself updates the item (causing an infinite loop)
What I've Tried
Some posts suggest using a Service Account to run the flow and then apply the logic:
If the flow was triggered by a Service Account, terminate the flow
But I do not have access to a service account in this scenario.
The simplest solution seems to be answers like this one and this one.
They suggest creating a column in the SharePoint List to store a 'flag'.
I understand the concept of using flags to indicate:
DO run the flow if SOME_FLAG is false
DO NOT run the flow if SOME_FLAG is true
But I am having trouble when it comes to implementing them properly in this scenario.
Specifically, I have added a Yes/No column to my List called LastModifedByFlow.
The default value is No (i.e. false).
My flow is structured like this:
01) TRIGGER: When an item is created or modified
02) I have added this Trigger Condition
#equals(triggerBody()?['LastModifiedByFlow'],false)
03) This means the flow will run when LastModifiedByFlow is false
04) Create some variables
05) ACTION: Update the item - this includes setting the LastModifedByFlow value to true
Question
The first time the flow runs, it works great:
the item is updated
the item's LastModifedByFlow value is set to true so the flow doesn't run again
But how and where in the flow do I set the LastModifedByFlow value back to false?
So that the flow will run each time a user subsequently modifies the list item?
It is recommended that you set a default value of “Yes” for the Yes/No column first. When the item is created, the flow will be triggered. After the flow is completed, the value of the column "Yes" will become "No". When the item is modified, it is recommended to manually change "No" to "Yes" to trigger the flow. Here is a post for your reference.
I am creating the logic app when I want to send an email when there are duplicate entries created in my database, and until those are not removed email should be triggered after some interval
As per Logic App, we can create a trigger on SQL when data is inserted or modified as bellow
So I selected the first option then I am adding another action which will run my SQL script to check the logic of duplicate entries
and last I have added another action to send an email.
Now I want my last action of sending email to be executed only when my query comes up with some result
You can use a Condition Control to check whether the given result set is valid if the condition satisfies then you can send the email
See my logic app below.
Here I've added the Execute a Stored Procedure Action. My stored procedure returns resultsets, you can use the logic for checking the duplicate and in the next condition you can check the duplicate result is true (or) false. If it's true you can send email else not to.
Update 1
How to Add condition control
I think you're better off programming the duplicate condition detection into a Stored Procedure rather than a SQL Trigger then using the Logic App change Trigger.
Instead, use a Logic App and Recurrence to call the Stored Procedure that queries for duplicates and returns the necessary meta data.
Trigger + table + change will be less reliable then you expect and much harder to maintain.
I am looking to create a workflow that will populate any mandatory fields that do not contain data when a company is deactivated. The mandatory fields are either not populated because of legacy data or because the mandatory fields have changed since the record was created.
The issue I get is that the mandatory field check takes place before the workflow is triggered.
My workflow looks like follows:
If Status = Inactive
If Company Name does not contain data
Then update to ‘Test’
I have come up with a possible solution:
• Create a new button in the ribbon that runs the workflow on-demand and apply permissions to this button.
If possible though I would like to do this through a workflow that is triggered on clicking of the ‘Deactivate’ button. Any ideas are welcome.
In your situation the record will not be saved until the mandatory fields are filled, and a workflow cannot be triggered if a record is not saved first.
An approach to solve this situation is to write a JavaScript attached to the OnSave event, but you need a rule to be able to identify the legacy records, so this JavaScript (that will fill the mandatory fields for you) will not run for normal records.
This approach is not tested, but with some tweaks should work.
I'm creating a workflow that does the following, and I'm looking for guidance on the best practices of splitting up a workflow into conditions and/or steps.
For the Projects list, each time a list item is created or modified, the workflow should run and do the following:
If Status = New, create a couple variables AND send specific email
If Status = Open, send specific email
If Status = Estimated, send specific email
If Status = Approved, send specific email
If Status = Ready, send specific email
If Assigned To is modified, send specific email to the Assigned To person or group.
If Status = Ready, and has been ready for more than 5 days, send specific email.
So for the first 5 items above, it seems to me they could all be separate conditions/actions within a single step.
For the Assigned To item, I think I'll need to have the primary workflow create a record in a new list, which would then trigger a secondary workflow to send the notification email to the Assigned To designee.
And for the Status over 5 days item, should this just be another condition/action under the primary workflow's step 1 or should it be a separate step?
In this scenario, I'm just not seeing any need for separate steps within the primary workflow. Am I missing something? What's the general thinking for when you should use additional steps in workflows, as opposed to just adding conditions?
Thanks!
I think I finally stumbled on the answer to my own question.
From what I can tell, in any step, the workflow will stop once a condition branch evaluates to true. So if more than one action needs to occur before the workflow is started again, then each of those conditions must be in it's own step. You can have a single step with multiple conditions of course, but only one of those conditions can evaluate to true.
Does this sound accurate?
The issue is that everytime an item is edited/changed all the users who are set up to receive updates are notified. I need the workflow to run only when a specific field is changed disregarding the others. For example if my item contains these values (Customer Name; Acc#; Contact Person; Address;) - I need the workflow to work only when the Acc# is changed and only if it is changed, no metter how many times the other fields are changed.
Thanks,
A quick way to do it is to have the workflow store the value each time the it starts, then tell it to wait until the field != the stored value. This may not work in all cases, but it could be enough for your purposes.
You should create an event handler to run on your content type or library. You can then check the before and after properties of the fields you mention. Then use the event handler to initiate the workflow if required.