Working in Sharepoint 2010, I have to create a Sharepoint Designer Workflow to query all the items in a list. I want to query the list and sort the results from highest to lowest based on project ID. From this I want to be able to find the highest value for project ID among all the items in the list (basically which item is the most recently created) and store that in a variable. I will use this variable to increment the value so I can set the project ID of the next item and so on. Additionally I cannot use the OOTB ID field which is why I am attempting to create an equivalent via workflow.

Unfortunately from my initial research it doesn't appear SPD has an action to query a list. Is there an option that I am missing or is there a different way to be able to achieve this OOTB?

  • 1
    Workflows run off of individual list items and not the entire list. There is no enumeration. The only way you can run it on every item in the list is to do information management policy. That still moves through each item in the list one by one. What are you trying to do with the workflow? Can you provide more information please?
    – lazoDev
    Commented Jan 17, 2019 at 19:04
  • @lazoDev Provided a but more context surrounding what I am trying to accomplish if that's helpful.
    – bberndt
    Commented Jan 17, 2019 at 19:28

2 Answers 2


Is there a particular reason you can't use the OOB ID field? If you simply can't use that particular field, you could create a new calculated field that used the ID as the value.

Another option is to have another utility list. In the workflow, add an item to that list, and use the ID of the new item in the utility list as the project id. (This solution is pretty easy to set up, and it won't generate the same ID for two projects, which is something that could happen if you are querying a list.)

If you must go the query route, you can have a developer create and deploy a custom workflow action that queries the list and returns the max project id.


You could set up a helper list with a single item and a number column. Manually enter the starting number into that item.

Then, write a workflow in your project list that fires when a new item is created. The workflow will

  • retrieve the item of the helper list and read the number into a variable
  • increase the number by one
  • update and save the increased number in the helper list
  • use the increased number as the project ID of the current item.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.