• vadim@workflowexcellence.com
  • Utah, United States

Nintex Workflow 2010 – SharePoint User Group UDAs

I’ve noticed that in the past couple of years, I’m doing more with SharePoint web service calls from Nintex Workflow. The problem is (it’s not really a problem), is that most users are a little afraid of web services. They don’t really know what they are, or what permissions they need etc.

There are 2 web services that are part of SharePoint that I tend to use a lot. Lists.asmx web service. I still use that quite often. It’s not only good for real work, but also for debugging and seeing the current value of fields, or getting a collection lists or items etc. The other web service I am starting to use more is the UserGroups.asmx web service.

Here’s the rub. I’m getting tired of :
1. constantly add a Call Web Service action
2. configure the url
3. configure the credentials
4. click on Refresh
5. select the web method
6. fill in all the details
7. enable error handling etc.

So I decided to wrap up my UserGroup web service calls into UDA (User Defined Actions).

For now, I have only made 4 fairly simple UDA’s. There’s one thing that all these UDA’s have in common, and that is, they use a Nintex Workflow Constant named “Admin Credentials”. If you want to have a different credential, then feel free to update the UDA’s.

Add Group UDA – MSDN Description

This UDA will let you create a group in your current site.

All the UDAs have input and output parameters that they take. I won’t go into the details of each one, because they are almost identical. If you want to know what input parameters they take, each UDA uses a specific web method in the UserGroups.asmx web service. MSDN Documents these methods.

 I’ve also set up an Error Occurred yes/no output parameter and an Error output parameter. If the UDA fails for any reason, it will set the Error Occurred to YES and set the Error parameter to the reason of the failure. That way you can handle it in your workflow.

I have a few things I check first of all, before trying to run the web service call. I check to make sure all the required fields have some information, and that one of the fields has one of two valid values as defined by the documentation on that action.

The UDA looks like this:

If you design a workflow to use this UDA and check the error, if you run it to create a group that already exists, you’ll end up catch an error like this :

“Error : Error returned from server: The specified name is already in use.”

Configuring the UDA action:

Remove Group UDA – MSDN Description

This UDA will allow you to remove a group. There is currently no checking if the group exists (although you could use the action from the previous blog article –

Does List Exist User Defined Action

).

This simply checks if a group name is provided.

Configuring the UDA action:



Add User to Group UDA – MSDN Description

This action allows you to add a user into a group on the current site.

Again, we aren’t checking in the group currently exists, or even if the user currently exists. The Call Web Service action has error handling enabled, so any errors will be caught and put into the Error parameter.

Configuring the UDA action:



Remove User from Group UDA – MSDN Description

As above, but in reverse. Removes a user from a group, but doesn’t confirm either actually exist.

Configuring the UDA action:

Conclusion

Once you have these UDA’s, you can go to Manage User Defined Actions in Nintex Workflow 2010 and import them in. Make sure you have the “Admin Credentials” constant, otherwise this won’t work at all.

When you have them imported and published, in the Nintex Workflow designer, you’ll see this:

Downloads

Four SharePoint UDAs: Download

Leave a Reply

Your email address will not be published. Required fields are marked *