cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MattH2
Helper I
Helper I

Question on a Formula

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)

 

Add(item()['Submission Count'],1)  Returns the following error:e2.PNG

 

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
Jcook
Super User III
Super User III

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:

 

pic1.png

 

 

pic2.png

 

 

pic3.png

 

 

pic4.png

 

—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


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





View solution in original post

10 REPLIES 10
Jcook
Super User III
Super User III

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


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





@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. 

RS1.PNG

 

 

 

 

 

 

 

 

 

 

If the condition is met, get attachments from the list, move them to a folder, delete the attachments from the list.

RS2.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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.

 

RS3.PNG

 

 

 

 

 

 

 

 

 

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).

RS4.PNG

 

 

 

 

 

 

 

 

 

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.

RS5.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Any ideas?

 

 

 

 

 

 

Jcook
Super User III
Super User III

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

 

 


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





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

Jcook
Super User III
Super User III

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:

 

pic1.png

 

 

pic2.png

 

 

pic3.png

 

 

pic4.png

 

—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


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





View solution in original post

@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.

 

rs7.PNG

 

 

 

 

 

 

 

 

 

 

 

 

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:

 

rs6.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

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?

 

rs8.PNG

Jcook
Super User III
Super User III

Hi,

Yes can you please try to change the name to have no space.

At which step are you grabbing Submission Count from?

In the failed run the compose that is holding the submission count. Click the click here to download.. what do you see?

If it’s empty something is going weird and you are grabbing a field that is being referenced from a different action. Or the value is empty.

—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

Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





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.

RS9.PNG

RS10.PNG

 

 

@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

Helpful resources

Announcements
MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (82,007)