I think this should be easier, but searching the forums for an example/help is proving to be difficult.
I have a SP List that has a Column called Submission Count. It is a type Number with a default starting value of 1.
I have a Flow that updates the Sharepoint list whenever certain conditions are executed. I am attempting to write an expression to update the Submission Count value by adding a 1 to it. I have tried several variations of formulas I have found in the forum including:
Add(items('Apply_to_each')?['Submission Count'],1)
One would think adding a counter to a list would be a relatively simple process, but I cannot seem to crack it. Any and all help appreciated.
Thanks in Advance,
Matth
Solved! Go to Solution.
Hello @MattH2
Okay I found a issue in your loop. You are using the output in the loop 'Body' This needs to be 'Value'.
That is why you cannot reference (SubmissionCount) does not exist.
Anyway here is my flow:
—Josh
If you like my post please hit the "Thumbs Up" -- If my post solved your issue please "Mark as a Solution" to help others
Proud to be a Flownaut!
Hello @MattH2
Could you share a picture of the flow.
What are you passing in the Update item action.
—Josh
If you like my post please hit the "Thumbs Up" -- If my post solved your issue please "Mark as a Solution" to help others
Proud to be a Flownaut!
@Jcook - I was (dreaming) hoping this would be an easy formula fix 😅-- but here goes. It is a pretty lengthy FLOW. I think the relevant part is the last 2 pictures, but I put the whole FLOW out here in case something else was relevant.
When an item is created or modified in the SA_Contract_FLOW list, Get Items from a different list (SA_Contract_Approval) and execute a condition.
If the condition is met, get attachments from the list, move them to a folder, delete the attachments from the list.
Lastly, it updates some information on the SA_Contract_Flow List and Adds a NEW Record to the SA_Contract Approval List. Wat I am trying to do, is take the Value of Submission Count Field (Get Items) and then Create a new entry with Submission Count +1.
How do I grab the current value of the field from the Get Items in the step before Create Item and add 1 to that value. For the record, there is an ODATA filter Get Items that asks to only get the Record from SA_Contract_Approval where the Unique_ID equals the UNIQUEID in the SA_Contract_FLOW list (The item that is being created or modified in the first step of this flow).
Here is the output of the flow. Please note I already corrected the space in "Submission Count" in the displayed Formula and retested, with the same results.
Any ideas?
Hi @MattH2
I am a bit confused as you are referencing the property Submission Count in your Add expression but the field name is SubissionCount.
What I suggest is that you add the value 1 outside the create item action.
Use a Compose action and use the expression add() but instead of passing the item() pass the actual value from SharePoint Dynamic content.
—Josh
If you like my post please hit the "Thumbs Up" -- If my post solved your issue please "Mark as a Solution" to help others
Proud to be a Flownaut!
Could you post an image of what you described.
I struggle with the right syntax when it comes some of these expressions and formulas.
The Field Name is Submission Count, with a space in it. I noticed that the output data stripped the space, so I tried my expression without the space and am still getting an error - so I figure I have a syntax issue.
Many thanks for the help,
Matth
Hello @MattH2
Okay I found a issue in your loop. You are using the output in the loop 'Body' This needs to be 'Value'.
That is why you cannot reference (SubmissionCount) does not exist.
Anyway here is my flow:
—Josh
If you like my post please hit the "Thumbs Up" -- If my post solved your issue please "Mark as a Solution" to help others
Proud to be a Flownaut!
@Jcook Thanks for all the help with this. Unfortunately, I am getting an error on the Compose 2. Note: I moved the "Get items" out of the prior "Apply to Each" section as the "Get Items" is really not dependent on anything within that loop.
Here is the FLOW.
I am getting the following error on the Compose 2 command, and I am confused by it as it looks exactly like yours. Here is the error:
Appreciate all your help.
best,
Matt
@Jcook I thought it might be helpful to include the following screenshot that shows the result of the Get Items. I am not sure why the Submission Count field is displayed as SubmissionCount (no space). The Column name in the Sharepoint list has a space. Could this be my issue?
Proud to be a Flownaut!
Thanks @Jcook . I really appreciate your help and agree something weird is going on. When I click the Link to Download both Inputs and Outputs, I get a blank browser tab. I did update the name of the Column Submission Count to SubmissionCount (No space) and reselected those entries from the Dynamic content screen.
Another weird part (discovered by accident) is that it does occasionally work. I accidentally triggered a loop with the flow so it ran about 50 times in a row, adding a unique entry to my Contract_Approval List each time. I have SubmissionCounts ranging from 2 to 7. This is the only place I touch that column. I am going to start working on an alternative solution. All I am trying to do is add a New Entry to a Contract_Approval Sharepoint list and Archive (change status column) the original entry.
Note: the screen grab on the right was taken prior to the field name change for Submission Count.
Here is a screen grab of the Compose Actions and verification that the "Value" for the Apply to Each is coming from the Get Items Command.
@Jcook --- I was able to get this working.
I think the issue may have been a default 0 value in the SubmissionCount field. I changed the Default Value to 1 and things seems to be executing correctly.
Best,
Matth
User | Count |
---|---|
35 | |
15 | |
14 | |
13 | |
9 |
User | Count |
---|---|
42 | |
30 | |
26 | |
14 | |
12 |