Hey all!
I have a patch statement that unfortunately is causing my flow to trigger twice and was hoping you could help me roll it into a single statement to help eliminate the patch from my troubleshooting.
Context of what patch is doing.
First patch sets the old record in SQL to current flag false
Second patch sets the new record in SQL to approved, adds approval date, and sets the current flag of the record to true.
Here it is:
Patch(
'[dbo].[SoFriendly]',
First(
Filter(
'[dbo].[SoFriendly]',
Emp_Per_ID = Value(DataCardValue2.Text)
)
),
{Current_Flag: false}
);
Patch(
'[dbo].[SoFriendly]',
First(
Filter(
'[dbo].[SoFriendly]',
Emp_Per_ID = Value(DataCardValue1.Text)
)
),
{Payroll_Approval_Status: Payroll_Approval_Dropdown.SelectedText.Value, Payroll_Approval_Date: Date_Label.SelectedDate, Current_Flag: true}
);Navigate(Landing);Reset(Payroll_Approval_Dropdown);
Solved! Go to Solution.
I believe it is the following but will have to try tomorrow when I am back in the office.
Patch(
'[dbo].[SoFriendly]',
First(
Filter(
'[dbo].[SoFriendly]',
Emp_Per_ID = Value(DataCardValue2.Text)
)
),
{Current_Flag: false},
First(
Filter(
'[dbo].[SoFriendly]',
Emp_Per_ID = Value(DataCardValue1.Text)
)
),
{Payroll_Approval_Status: Payroll_Approval_Dropdown.SelectedText.Value, Payroll_Approval_Date: Date_Label.SelectedDate, Current_Flag: true}
);Navigate(Landing);Reset(Payroll_Approval_Dropdown);
I believe it is the following but will have to try tomorrow when I am back in the office.
Patch(
'[dbo].[SoFriendly]',
First(
Filter(
'[dbo].[SoFriendly]',
Emp_Per_ID = Value(DataCardValue2.Text)
)
),
{Current_Flag: false},
First(
Filter(
'[dbo].[SoFriendly]',
Emp_Per_ID = Value(DataCardValue1.Text)
)
),
{Payroll_Approval_Status: Payroll_Approval_Dropdown.SelectedText.Value, Payroll_Approval_Date: Date_Label.SelectedDate, Current_Flag: true}
);Navigate(Landing);Reset(Payroll_Approval_Dropdown);
Seems like your code is updating 2 different ID's in SQL, is this correct? If so, and your Flow is "when an item is created or modified", then it will run twice because you are making 2 modifications. If this is the case, try putting a condition in your Flow that stops this
Eg. if Current_Flag = false do nothing else do your Flow.
I don't think your second code bit will work? Haven't tested it, just doesn't look like it would.
Yes updating two records in SQL. The patch definitely works as is. I could have as many patches as I want like that, as long as they all point to valid data sources and the data I'm plugging in matches, why not.
I will try and figure out how to stop flow based on your recommendation and report back.
User | Count |
---|---|
185 | |
122 | |
91 | |
47 | |
42 |
User | Count |
---|---|
270 | |
158 | |
130 | |
84 | |
78 |