Wednesday, March 7, 2012

Query between Site Collections using Nintex-SharePoint web services

I've a Global approval matrix (Just a SharePoint List with Approver name, Range & their respective Entity) in a site collection. For a workflow requirement, I had to retrieve the approver(s) and their E-mails based on Entity and Credit amount from Global approval matrix List in a different site collection.

Here is my global approval matrix List:

Again, Nintex and SharePoint web services comes to rescue.I designed the Nintex workflow to achieve this. and here, from the Nintex workflow, I'm giving the Query & Update chunks alone.

Lets Begin with these Nintex Variables:
 I used 3 variables:
  1. varApproverMatrix -To hold the XML from web service
  2. varApprovers - To hold the approver(s)
  3. varEMails - To hold the approver's Emails.
Query Approval Matrix List:
We'll be using GetListItems SharePoint web service to retrieve List items of the another site collection. So Lets drop a Call web service action and enter the URL as:, and supply the user name & password, and then send the resulted XML to our variable: varApproverMatrix

We'll update the SOAP XML for our requirement:
Click on Edit SOAP link and enter the below XML in it.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="" xmlns:xsd="" xmlns:soap="">
        <GetListItems xmlns="">
                 <FieldRef Name='BP_x0020_Entity'/>
                 <Value Type='Text'>{ItemProperty:Entity}</Value>
                    <FieldRef Name='From_x0020_Amount' />
                    <Value Type='Number'>{ItemProperty:Credit}</Value>
                    <FieldRef Name='To_x0020_Amount' />
                    <Value Type='Number'>{ItemProperty:Credit}</Value>
     <FieldRef Name="Approvers" />
     <FieldRef Name="EntityInbox" />
   <queryOptions xmlns:SOAPSDK9="" >
Here the <query> tag is the filter and <viewFields> tag is for the fields we would like to retrieve.

Remove Extra Chars from User Name:
We need this step in order to replace some extra character's in the Approver's name. Internally, SharePoint stored the User names in this format: ID;#FirstName, LastName. So, lets get rid of ID;# using Regular expressions.

Query Approvers Field:
We retrieved the List data in XML format. Lets add a Query XML action to query using XPath and save the values to varApprover.

Update List Items:
Finally, we retrieved user names and E-Mails, Lets update them in List using Nintex's Update List Item action.

 MSDN Reference for GetListItems :

I used CAML Query builder to build the query in SOAP, For Regular Expression, I used

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.

Check out these SharePoint products:

No comments :

Post a Comment

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...