Friday, May 30, 2014

Nintex User Defined Action to get Emails from a SharePoint Group


Nintex has a neat little thing in SharePoint 2013 called a User Defined Action (UDA). It takes in inputs, does some stuff, and then spits out outputs. It's a handy way to create an action that you can reuse within your workflows.

In this guide, I walk you through how to create a UDA for grabbing e-mail addresses from a SharePoint group. Let's get started.


You will start by creating a new User Defined Action.
  1. On your site collection administration page, under the "Nintex Workflow" Heading, select Managed User Defined Actions

Then Select "Create" from the "Manage User Defined Actions" tab on the ribbon.

Then create one input parameter and one output parameter. From the ribbon, select "Parameters" from the "UDA Settings" button on the "Manager User Defined Actions" tab on the ribbon. It looks like this:

Add the following parameters:
  1. Input: GroupName, Text
  2. Output: UserEmailCollection, Output

Then add two Actions:
  1. Call Web Service
  2. Query XML

Configure "Call Web Service" action as follows:

  1. URL is the location of the UserGroup.asmx web service. I use web URL here, but you can use a site collection URL as well.
  2. Workflow Credentials for the web service. In this case, I use a variable that stores the credentials.
  3. Hit refresh and the drop down will populate with a list of methods. Choose "GetUserCollectionFromGroup"
  4. You can choose either Editor mode, but, in this case, "SOAP builder" makes it easier
  5. "groupName (string)" is the input parameter to the Web Service. In this case, we are going to pass the UDA parameter "GroupName" (we created this in a previous step) to the web service parameter.
  6. Select "Specify elements"
  7. When you select "Specify elements" you will be presented with a dialog. Make sure expand the nodes until you get to GetUserCollectionFromGroupResult. Then select it.
  8. Output your result to a workflow variable. In this case, I created one called, "UserXML"

Configure the "Query XML" action as follows

  1. Select your "XML" as your "XML source"
  2. Select "Insert Reference" and then put in your Workflow Variable that was output from the previous step. In this case, "UsersXML"
  3. Process using "XPath"
  4. Add the following XPath (without the quotes): "/defaultNS:GetUserCollectionFromGroup/defaultNS:Users/defaultNS:User/@Email"
  5. Return results as "Text"
  6. Store the result in the output parameter that you created earlier. In this case, "UserEmailCollection"

Don't forget to publish it!

No comments:

Post a Comment