After many moons, I finally decided to sit down and automate some work that I regulary did manually. One of the steps required a url to be encoded so I could post it to another site.
There’s no action in Nintex Workflow to encode a url this way, so the option was to either develop a custom action, inline function, or design a User Defined Action.
I chose to make a User Defined Action as the encoding I needed was quite simple. A simple character replacement.
For those interested, w3schools has a good page on what characters need to be encoded : http://www.w3schools.com/tags/ref_urlencode.asp
As I know my urls are only going to have colons ‘:’ and forward slashes ‘/’, that’s all my UDA is catering for. So the UDA only contains a Build String action. But I can see in the future that I will be adding to this UDA, which why I decided to make this functionality into a UDA, rather than just using a simple Build String action in each workflow I design.
The parameters this UDA takes, is one input and one output. Fairly self explanatory right?
The UDA contains a single action, and that is the Build String action. The Build String action uses an inline function called fn-Replace, to replace each character with the associated encoded version. As I mentioned, this only handles colons and forward slashes, but you can add more.
Ideally, I would handle every character, but for now, this suffices my needs. If you need to handle other characters, simply add fn-Replace function call to the Build String action.
Input : http://www.nintex.com
Output : http%3A%2F%2Fwww.nintex.com