Nintex Workflow

Nintex Workflow – Developing a Custom Inline Function

In my eyes, I generally don’t like to develop something if there’s already software that does it.  Why reinvent the wheel?  But one thing that I find is a must in the software I look at, is that it can be extended through code.

Nintex Workflow can be extended a number of ways.  In fact, most of the workflows I have built, whether they are simple or extremely complex, require no coding.  When you think about it, isn’t that what you want from a workflow product?  With Nintex Workflow, there’s an SDK (Software Development Kit) and you can develop custom actions, custom inline functions, web services etc.  It’s very flexible and if you do hit a scenario where you need to add some custom functionality, you can definitely do it.

This post is about how easy it is to develop a custom inline function.  I’ve posted a number of times around Inline functions, but this will actually show you some code, so it’s a little more on the advanced side.


Visual Studio is needed to develop a .Net Class Library.  I haven’t tried this with any other development environment, like Mono.

The function you want to build, needs to be in a class and the function in the class needs to be a static function.

I’ve found that it was easier if the .Net Framework the project was built against, was the .Net 3.5 framework.

Finally, in Visual Studio, you need to make sure the assembly is signed and therefore it will build a Strongly Named assembly, as that is what is needed to be added to the GAC (c:\windows\assembly).

Once the library is built (into a .dll), you will need to deploy it to your farm servers.  You can simply drag the assembly into the GAC, or look at building a SharePoint solution that gets added to SharePoint and deployed to all farm servers.

Finally, you need to also access the server where you initially ran the Nintex Workflow installer.  On that server, you’ll find a command line tool named NWAdmin.exe.  For Nintex Workflow 2010, it’s in c:\Program Files\Nintex\Nintex Workflow 2010 and for Nintex Workflow 2013, it’s in the Bin folder in the hive.

The NWAdmin.exe tool has an operation named AddInlineFunction and that allows you to add inline functions to Nintex Workflow.


The need I had, was the ability to generate random numbers.  Since .Net has a Random class, but it doesn’t expose its methods as static methods, I created my own class library that wraps those.  This example is about as simple as you get for building a custom inline function, since it’s only a few lines of code. 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VTInlineFunctions
    public class VTRandom
        public static int Random()
            Random rnd = new Random(Environment.TickCount);
            return rnd.Next();

        public static int Random(int _iMax)
            Random rnd = new Random(Environment.TickCount);
            return rnd.Next(_iMax);

        public static int Random(int _iMin, int _iMax)
            Random rnd = new Random(Environment.TickCount);
            return rnd.Next(_iMin, _iMax);

I told you it wasn’t a lot of code.  Of course, since you can write code, you can really get it to do anything you want, but this will give you a starting point.

In order to add this to Nintex Workflow, here’s an example of what the command line looks like:

nwadmin -o AddInlineFunction -functionalias “fn-VTRandom” -assembly “VTInlineFunctions, Version=, Culture=neutral, PublicKeyToken=eecb9361e97d9908” -namespace “VTInlineFunctions” -typename “VTRandom” -method “Random” -description “Generates a random number.” -usage “fn-Random() or fn-Random(max) or fn-Random(min,max)”

In the downloads section below, I’ll make available the assembly (dll), a text file (that has the above command line) and also the source code if you feel like you want a starting point,. 

What does the above custom inline function do?  I describe it in the video above, but basically, it allows you to generate random numbers in a workflow or form. 

Benefits of a Custom Inline Function

When you add custom inline functions, it extends what you can already do out of the box with Nintex Workflow.  You’ll find these available here:

Inline Function in Nintex Workflow

Anywhere, where you can insert a reference in Nintex Workflow (Build String, Send Notification, Task actions etc), you can use Inline Functions and that includes the custom functions you make.

The hidden extra that you get, is that you can use your custom inline function in Nintex Forms also.  Anywhere, where you can build an Expression, you can use your Inline Function:


Hopefully this opens your eyes to some of the more advanced ways of extending your workflows and forms.

You don’t have a development team but you need some added functionality?  Feel free to get in touch with the Nintex Sales or the Nintex Territory Manager that handles your account and they can get you in touch with a number of very capable Nintex Partners that could help you out here.


*** UPDATE ***

5/28/2014 – Add more inline functions (fn-VTRegexDoesMatch,fn-VTIsCreditCardNumber and several inline functions that check for specific types of credit cards – AMEX,VISA etc).

4/4/2014 – I changed my inline function name to fn-VTRandom.  That way, if someone else has already built a fn-Random, this won’t interfere.


Nintex Workflow 2013

Download the Custom Inline Function Assembly

Download the Custom Inline Function Source Code

Leave a Reply