cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Nintex Newbie

Query Dynamic List with Dynamic ViewFields

Jump to solution

Scenario : a site workflow will read a configuration list which has details of other lists like (list name, list GUID, list Url, query condition, query view fields etc), based on the input the site workflow needs to query those lists and given condition to get respective view fields data for further processing.

Expected query result column values will vary for each list been queried and will be mentioned as part of <ViewField>. 

Question:

Is it possible to have ViewFields to be added dynamically using QueryList or Call WebService workflow actions? If yes how, else any alternate option.

Thanks in advance.

0 Kudos
Reply
17 Replies
Highlighted
Automation Master
Automation Master

Re: Query Dynamic List with Dynamic ViewFields

Jump to solution

it should be possible.

following worked for me

Reply
Highlighted
Nintex Newbie

Re: Query Dynamic List with Dynamic ViewFields

Jump to solution

Thanks for the response Marian Hatala

The workflow variable {WorkflowVariable:QueryViewFields} will vary everytime.

Example :

When querying List A, {WorkflowVariable:QueryViewFields} will have <FieldRef Name="EmpName" /><FieldRef Name="EmpAddress" />.

next when querying for List B <FieldRef Name="ID" /> will have <FieldRef Name="CustomerName" /><FieldRef Name="CustomerAddress" />

In which Fields needs to be populated at runtime.

Is it possible with Call Web Service action?

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m="http://schemas.microsoft.com/sharepoint/soap/">
<soap:Header>
</soap:Header>
<soap:Body>
<m:GetListItems>
<m:listName>{WorkflowVariable:ListName}</m:listName>
<m:viewName>string</m:viewName>
<m:query>{WorkflowVariable:QueryToGetBlankSignOff}</m:query>
<m:viewFields>{WorkflowVariable:QueryViewFields}</m:viewFields>
<m:rowLimit>string</m:rowLimit>
<m:queryOptions>xml</m:queryOptions>
<m:webID>string</m:webID>
</m:GetListItems>
</soap:Body>
</soap:Envelope>

Reply
Highlighted
Automation Master
Automation Master

Re: Query Dynamic List with Dynamic ViewFields

Jump to solution

with web service call you should be able to get whatever you like.

you just need to build correct CAML - in your example there are some not populated input parameters (view name, row limit, etc.). so either populate them with valid values or remove them from CAML.

if you have properly formatted content of workflow variables, it should work.

View solution in original post

Reply
Highlighted
Nintex Newbie

Re: Query Dynamic List with Dynamic ViewFields

Jump to solution

The below is the XML which fails as "The remote server returned an error: (500) Internal Server Error.". Can please have a look and advise?

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m="http://schemas.microsoft.com/sharepoint/soap/">
<soap:Header>
</soap:Header>
<soap:Body>
<m:GetListItems>
<m:listName>OTC 5</m:listName>
<m:query>
<Query>
<Where>
<IsNotNull>
<FieldRef Name="OTC_x0020_07_x0020_47_x0020_Signoff_x0020_1" />
</IsNotNull>
</Where>
</Query>
</m:query>
<m:viewFields><ViewFields><FieldRef Name='OTC_x0020_07_x0020_47_x0020_Reviewer_x0020_1'/></ViewFields></m:viewFields>
<m:queryOptions><viewfieldonly>true</viewfieldonly></m:queryOptions>
</m:GetListItems>
</soap:Body>
</soap:Envelope>

Reply
Highlighted
Automation Master
Automation Master

Re: Query Dynamic List with Dynamic ViewFields

Jump to solution

1. correct syntax/structure for query options should have been (ie. one extra <QueryOptions> XML element)

<m:queryOptions><QueryOptions><viewfieldsonly>true</viewfieldsonly></QueryOptions></m:queryOptions>

2. viewfieldonly should have been viewfieldsonly (ie fieldS)

3. viewfieldsonly just like IncludeMandatoryColumns are often reported as not working

c# - How to Return Only Certain Columns of a List When using the SharePoint Web Service? - Stack Ove... 

Reply
Highlighted
Nintex Newbie

Re: Query Dynamic List with Dynamic ViewFields

Jump to solution

Still face the same error with below call:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m="http://schemas.microsoft.com/sharepoint/soap/">
<soap:Header>
</soap:Header>
<soap:Body>
<m:GetListItems>
<m:listName>OTC 5</m:listName>
<m:query>
<Query>
<Where>
<IsNotNull>
<FieldRef Name="OTC_x0020_07_x0020_47_x0020_Signoff_x0020_1" />
</IsNotNull>
</Where>
</Query>
</m:query>
<m:viewFields><ViewFields><FieldRef Name='OTC_x0020_07_x0020_47_x0020_Reviewer_x0020_1'/></ViewFields></m:viewFields>
<m:queryOptions><QueryOptions><viewfieldsonly>true</viewfieldsonly></QueryOptions></m:queryOptions>
</m:GetListItems>
</soap:Body>
</soap:Envelope>

0 Kudos
Reply
Highlighted
Automation Master
Automation Master

Re: Query Dynamic List with Dynamic ViewFields

Jump to solution

structure seems to be correct, check correct spelling of names.

(shouldn't eg. list name be OTC_x0020_5?)

I've taken your CAML, updated names to my testlist, and it worked for me (SP2013)

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m="http://schemas.microsoft.com/sharepoint/soap/">
<soap:Header>
</soap:Header>
<soap:Body>
<m:GetListItems>
<m:listName>testlist</m:listName>
<m:query>
<Query>
<Where>
<IsNotNull>
<FieldRef Name="slot" />
</IsNotNull>
</Where>
</Query>
</m:query>
<m:viewFields><ViewFields><FieldRef Name='Title'/></ViewFields></m:viewFields>
<m:queryOptions><QueryOptions><viewfieldsonly>true</viewfieldsonly></QueryOptions></m:queryOptions>
</m:GetListItems>
</soap:Body>
</soap:Envelope>
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Reply
Highlighted
Nintex Newbie

Re: Query Dynamic List with Dynamic ViewFields

Jump to solution

This issue was in the field name. 

Here is the details:

  1. The mentioned fields are InfoPath fields which appear in side ows_MetaInfo and not as z:row properties as highlighted below
  2. I can see those columns in list settings page as well in U2U builder too

Any advise? 

Reply
Highlighted
Automation Master
Automation Master

Re: Query Dynamic List with Dynamic ViewFields

Jump to solution

I do not have experience with infopath and do not know what is U2U.

but if you can see columns in list settings you should be able query them.

navigate into column settings page and check URL what column name appears there. use that name in CAML.

Reply