question

KellyTaggart-5226 avatar image
0 Votes"
KellyTaggart-5226 asked AllenXu-MSFT commented

SP 2013 Workflow - Find Max ID of List

I am creating an SP 2013 Workflow with a "Loop" step to delete other list items. This works as I would expect.

Multiple items will be created at the same time (created from submitting a form from another library) so I only want the "Loop" step to run on the item with the Max ID. So, I was going to create an IF Condition of - IF Current Item ID = Max ID in List - then run the Loop otherwise go to next Stage.

I'm struggling with a way to identify in the Workflow what is the current Max ID? Any ideas?

sharepoint-workflow
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

KellyTaggart-5226 avatar image
1 Vote"
KellyTaggart-5226 answered AllenXu-MSFT commented

Hi @AllenXu-MSFT - I did look at that post and I know Laura does some pretty good stuff. For what I was after I thought it just looked like too much work.

What I did do in the end was in InfoPath form that submits the list items, I added an Action Rule to the Submit button to "Set Field Value" of a Text Column to "max(ID)+1 and Queried this Data Connection of the List.

Then in the workflow, I added an Action of "IF Current Item ID=MaxID (from above), run the Loop on this item. Seemed to the trick.

Thanks for pointing me in the right direction though!


132209-image.png



image.png (15.3 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@KellyTaggart-5226 ,

Thanks for your reply. Glad to hear you have solved this problem. I have convered your reply to answer and you can accept your answer via "Accept Answer" button. It will be beneficial to others who meet similar problems to yours. Much appreciated for you contribution :)

1 Vote 1 ·
AllenXu-MSFT avatar image
1 Vote"
AllenXu-MSFT answered AllenXu-MSFT converted comment to answer

Hi @KellyTaggart-5226 ,

To loop through multiple SharePoint list items in the workflow, you can use Call HTTP Web Servcie action. Below article covers how to loop through list items, please take a refernence to it: WORKFLOW LOOP THROUGH MULTIPLE SHAREPOINT ITEMS.

Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.


If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for the suggestion @AllenXu-MSFT - let me go over it and I'll post back soon!

0 Votes 0 ·

Is there any update?

0 Votes 0 ·