Vadim Tabakman

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

Add Group UDA:

Download

Remove Group UDA:

Download

Add User to Group UDA:

Download

Remove User from Group UDA:

Download

Posted by Vadim Tabakman Monday, February 6, 2012 7:39:00 PM Categories: Nintex Nintex Workflow User Defined Actions
Copyright Vadim Tabakman
Rate this Content 3 Votes

Comments

Sunday, February 26, 2012 3:25:27 PM

re: Nintex Workflow 2010 - SharePoint User Group UDAs

This is interesting.

Sunday, February 26, 2012 3:30:28 PM
Test user

re: Nintex Workflow 2010 - SharePoint User Group UDAs

This is just a test

Monday, February 27, 2012 11:23:59 PM
Sham

re: Nintex Workflow 2010 - SharePoint User Group UDAs

Nice blog. i am unablle to download the uda.

Tuesday, February 28, 2012 7:17:50 AM

re: Nintex Workflow 2010 - SharePoint User Group UDAs

Thanks for letting me know about that.  The UDAs should now be downloadable.

Thursday, August 23, 2012 3:51:59 PM
Jim Oleson

re: Nintex Workflow 2010 - SharePoint User Group UDAs

Great UDA's! All but one I've already written for myself Cool. Thanks for the info!! (Site is looking fantastic btw)

Friday, August 24, 2012 7:16:30 AM

re: Nintex Workflow 2010 - SharePoint User Group UDAs

Cheers Jim :)

Tuesday, July 16, 2013 8:12:10 AM
Rodrigo Tillmann

re: Nintex Workflow 2010 - SharePoint User Group UDAs

Very usefull this article!

Thx for sharing it with us Vadim!

Tuesday, July 16, 2013 9:20:49 AM

re: Nintex Workflow 2010 - SharePoint User Group UDAs

Glad you liked it Rodrigo.  Thanks.

Tuesday, October 29, 2013 7:20:42 AM
Christian

re: Nintex Workflow 2010 - SharePoint User Group UDAs

Hi Vadim,

I am testing your UDA with the farm account credentials and I still get the error message "The remote server returned an error: (401) Unauthorized". Would you have any idea why?

For information, the loopbackcheck option is disabled.

Thanks in advance,

Christian.

Tuesday, August 5, 2014 3:03:29 AM
Jahangir
Gravatar

re: Nintex Workflow 2010 - SharePoint User Group UDAs

Really great blog.Excellent stuffs.

 

Tuesday, August 5, 2014 8:15:02 AM

re: Nintex Workflow 2010 - SharePoint User Group UDAs

Thanks Jahangir

Thursday, April 16, 2015 2:01:41 PM
Adam Reyes
Gravatar

re: Nintex Workflow 2010 - SharePoint User Group UDAs

Great information!  Although I'm having trouble adding an existing group from the parent site into a sub-site using the UserGroups web service.  Is there another web service that does this?

Wednesday, October 14, 2015 6:08:01 AM
Dan Gorman
Gravatar

Nintex Workflow 2010 - SharePoint User Group UDAs

Not sure if you can help, but is there a specific level of credentials required to call the Web Service in the UDA?

Our IT contractor controls the level of rights of our credentials and while I hold site Collection Admin rights my Credentials do not allow the Service to be called. Even using a set of the Providers credentials doesn't call the Service (I tested this by, in the UDA, entering the credentials then refreshing the list of Web Methods will not refresh (with the message 'Request failed with status: Unauthorized.')

Any ideas?

Thanks,

Dan

Thursday, October 15, 2015 9:49:04 AM

re: Nintex Workflow 2010 - SharePoint User Group UDAs

Hi Dan,

it may not be the web service itself, but it could the site that you don't have access to.  Part of the URL contains the site/subsite and maybe your credentials don't give you access to that site.

As for what permissions, I don't know for sure as these are MS/SP web services.

cheers,

Vadim

Wednesday, April 20, 2016 8:33:37 AM
Mark Williams
Gravatar

re: Nintex Workflow 2010 - SharePoint User Group UDAs

Hello Vadim,

 

I saw this post and think it is very interesting.  i have a very complex poweshell script that creates a site.  In the script, one of the functions is to create custom groups with roles based on our governance policy.

My question is how can i use the UDA's to create a step that uses what you do but creates a group role using "addrolestogroups" webservice?  

Any advice would be great,

Mark

Wednesday, April 20, 2016 9:08:29 AM

re: Nintex Workflow 2010 - SharePoint User Group UDAs

Hi Mark,

In UserGroup.asmx, there is a AddGroupToRole web method.

Can you call that?

Vadim

Wednesday, January 18, 2017 10:27:09 AM

re: Nintex Workflow 2010 - SharePoint User Group UDAs

Hi there:

 

I just wanted to comment in case folks ran across this, as I did, and tried to implement it via Nintex Workflow 2013 - thinking "what the heck, should be the same."

The UDAs don't work for us 2013-ers, unfortunately, but it proved quite simple to just do 1 web service call to the AddUserToGroup with just the group name & UserLoginID filled out! Much easier than I was expecting, and this blog got me to that point - so - as always, thank you Vadim!

 

Rhia

Wednesday, January 18, 2017 11:15:09 PM

re: Nintex Workflow 2010 - SharePoint User Group UDAs

Oh awesome.  I had no idea these didn't work in 2013.

Thanks for the suggestions.  Told you, you're a fountain of knowledge.

Vadim

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





 

Statistics

  • Entries (253)
  • Comments (1737)

Categories