Vadim Tabakman

Nintex Workflow - Get Recurring Events UDA

This comes up fairly regularly, so it was a good time to post about this.  Especially after an exciting and inspiring Nintex InspireX User Conference.

I'm talking about the ability for a workflow to query a SharePoint calendar, and get recurring events.

There was a lot of searching online to find a way to create this User Defined Action.  But, finally it's done.  The aim of this UDA, is to give a Workflow designer, the ability to pass in SharePoint Calendar name and how long we period we want to look at.  It could be Today, Week, Month or Year.  The output of this UDA, will be 4 collections.  Event Title, Location, Start DateTime and End DateTime.

How does this work?

This all revolves around an awesome web service that SharePoint exposes, called Lists.asmx. Most specifically, the GetListItems web method. 

The UDA looks like this:

Here are the parameters of the UDA:

The UDA in this post uses a Call Web Service action.  In most cases, it's a great action to use as it tells you what fields need to be filled in in a cool user interface.  But it some cases, such as this one, the user interface doesn't cut it, and you need to get into the SOAP Editor Mode.  Now, you can put the SOAP packet together, even though it gives you a great starting off point.  Here's what the GetListItems web method call looks like :

<?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:CalendarName}</m:listName>
      <m:viewName>
      </m:viewName>
      <m:query>
        <Query>
          <Where>
            <DateRangesOverlap>
              <FieldRef Name="EventDate" />
              <FieldRef Name="EndDate" />
              <FieldRef Name="RecurrenceID" />
              <Value Type="DateTime">
                <Today />
              </Value>
            </DateRangesOverlap>
          </Where>
        </Query>
      </m:query>
      <m:viewFields>
      </m:viewFields>
      <m:rowLimit>
      </m:rowLimit>
      <m:queryOptions>
        <QueryOptions>
          <ExpandRecurrence>TRUE</ExpandRecurrence>
        </QueryOptions>
      </m:queryOptions>
      <m:webID>
      </m:webID>
    </m:GetListItems>
  </soap:Body>
</soap:Envelope>

I've highlighted a few things in the SOAP XML packet.  But really, the important things are the Today node.  This can be Week, Month or Year also.  Finally, in the QueryOption, there's a node called ExpandRecurrence, which is set to TRUE.

Watch the video above, as I mention a few things I encountered when getting this to work.  Nothing crazy, but if you're just learning about this web method, it's nice to know about some gotchas.

The Workflow looks like this:

After the usage of the UDA, we are going through all the event collections.  This is really just for debugging, but I'm sure you'll find a real business case for this.

Downloads

Nintex Workflow 2013

Download the User Defined Action - Download it, unzip it and import into the Manager User Defined Actions page

Download the Workflow - Download and import into the New Workflow page

Posted by Vadim Tabakman Monday, February 29, 2016 5:12:00 PM Categories: Collection Operation For Each Nintex Nintex Workflow Nintex Workflow 2013 Query XML User Defined Actions XPath
Copyright Vadim Tabakman
Rate this Content 0 Votes

Comments

Tuesday, May 17, 2016 4:23:22 AM
Bjarke Grønberg
Gravatar

re: Nintex Workflow - Get Recurring Events UDA

Hey Vadim

 

Looks great, but i think you uploaded the wrong UDA to your post ?
Could you please check it ? You are linking to a UDA called  Get_File_Extensions_UDA.nwf ?

Tuesday, May 17, 2016 7:14:17 AM

re: Nintex Workflow - Get Recurring Events UDA

good find. I'll fix that as soon ad I get on a computer.

thanks,

Vadim

Friday, May 20, 2016 1:27:56 AM
Bjarke Grønberg
Gravatar

re: Nintex Workflow - Get Recurring Events UDA

Thanks Vadim - had to make some changes to the CAML, but otherwise it works flawless! 

You must sign in to this site to post comments.
Already Registered?
Sign In
Not Yet Registered?
Register





 

Statistics

  • Entries (249)
  • Comments (1729)

Categories