Not applicable

Create a dynamic list ID

Jump to solution

I have a Site workflow that I am trying to run to look through a bunch of different sites and get data out of the lists so I can create an overall report of the data.

I have a master list that has all of the Keys and all of the sites have the same URL layout only with different keys. In my workflow I collect all of the keys and then use a For Each step to go one by one through the list items. Now I am stuck because I initially was going to use the Query List option but this wont work because I need a unique list ID for each. I am trying to find a way to query for the list ID within each site but can't seem to figure it out.

0 Kudos
Reply
6 Replies
tomcastiglia
Novice

Re: Create a dynamic list ID

Jump to solution

Can you clarify a few things about this your post?

  • When you say, "get data out of the lists"... what lists are you referring to?
  • When you say, "I have a master list that has all of the Keys"... what is this master list?  Is it a custom SharePoint list?  Can you provide a screenshot of this list or describe what columns and values that it contains?
  • What do you mean by , "all of the sites have the same URL layout only with different keys"?  Can you list examples of these URLs?

-Tom

Reply
Not applicable

Re: Create a dynamic list ID

Jump to solution

Unfortunately I am not able to provide any screenshots of the lists, but I will try to explain it a little better.

Within the master list there are several fields; dates, people picker, etc. Currently the Title column has been changed to "Key". The key started at 0001 and increases by 1 every time an item is created. Additionally, when an item is created a workflow creates a site based off of a template with the URL being the following: domain.[Key].aspx where the [Key] is in reference to the current item. Within each site there is a list that I am wanting to query and collect data from but the issue is that the Query List feature in Nintex workflows requires that I input a List ID. I am trying to find a way to turn the List ID in to a variable that I can look up for each site.

It seems like I might be able to do it using an XML query but I am not experienced enough with XML to know how to develop it.

Once I am able to dynamically look up the List ID I will be collecting information such as the total number of items in each list, averages, and some other metrics. (This portion I know how to do already)

Reply
pfudala
Novice

Re: Create a dynamic list ID

Jump to solution

Hi alinn,

You could use REST API in a "Query XML" action in order to obtain List IDs.

ListIds is a Collection variable so that you can loop in it.

You're also able to filter the result via XPath or directly inside the API by adding filters :

Reply
tomcastiglia
Novice

Re: Create a dynamic list ID

Jump to solution

Note that the Query List action allows you to specify the List ID dynamically, if you select the "CAML editor" option.  Basically, you format the entire query in CAML.  One trick to using this is to first configure your query using the Query Builder, then switch to the CAML Editor and it will generate all of the CAML code for you.  Then you replace the literal List ID with a variable.

Reply
janeyres
Novice

Re: Create a dynamic list ID

Jump to solution

Hi,

If it helps you can also use the list title in the CAML editor instead of the ID:

Jan

View solution in original post

Reply
Not applicable

Re: Create a dynamic list ID

Jump to solution

That works.

It's strange though because I tried it with one list and it didn't work, so that's how I got in to looking for a way to use the GUID for the list rather than the name. But I tried it again and it worked just fine. Thanks for the post.

0 Kudos
Reply