Nintex Workflow – Get Document Set Name UDA
This is going to be another one of those Nintex related posts where people will be asking me – “Isn’t it easier to just create a custom Inline Function with a little C# code???”.
I’ve been asked atleast 5 times over the last year, if it’s possible to get the name of the document set that a document is sitting in. I thought there were a number of ways of doing this, but it’s been one of those days and my brain is basically mush. So instead of probably finding some easy way, I put together a nice User Defined Action that I can pass in some information and it will let me know the document set name.
Why a User Defined Action?
When I’m putting together workflow logic, if I find something that I can reuse later on, I inevitably move to building a User Defined Action, because I don’t want to have to rebuild this logic later.
This is one of those occassions. Not only is this something I can reuse, but I can share this with you and you can download the UDA, import and publish it into your environment and you will have this available to you in any workflow that you design.
Don’t hide this from me, what does the User Defined Action do?
The UDA here is basically a nice wrapper for a bunch of Build String actions. We’re doing a number of inline function calls to replace bits and piece of text, until the end result is the Document Set name.
It’s no a complicated piece of logic, but there are 7 Build String actions and you don’t really want to build this logic everytime you need it in workflows. The UDA here makes it easier to reuse this logic.
The UDA has a required parameters.
1. Document URL
2. Web URL
3. List Name
4. Item URL (document filename)
5. Document Set Name (output parameter)
But how do I use this User Defined Action?
To use this UDA in a workflow, you simply drag it in from the group of actions in the Workflow design page.
When you drag it on, it’ll look like this :
Configuring the UDA in the workflow is also quite simple:
The result of this, is that if you have a document url:
http://www.mycompany.com/subsite/My Document Set/test.docx
Run that through the UDA, you will get this result:
My Document Set