Inline functions are used within Nintex Forms to perform a variety of different operations performed on the Server. Custom inline functions can be created within Visual Studio for use within Nintex Forms. In this article, we demonstrate how you can create additional custom inline functions for use in Nintex Forms (2013 and 2010).
A custom inline function may be able to leverage functionality from the .NET library. One such example is generating a Random number for use within a form with the .NET library Random number generator.
Once you have created a new inline function it will be available in the Insert Reference dialog of Nintex Forms controls.
The requirements for a function to be used by Nintex Forms are:
A function is referred to by its alias. A function can have multiple aliases to cater for localization. Localization of function names is done by adding a new alias for each language.
In this article, we’re going to step you through how to create a random number generator function. You may use this in cases where an unpredictable result is desired.
using System;
namespace CustomInlineFunction
{
public static class InlineFunctions
{
public static int Random()
{
Random randomNumber = new Random(Environment.TickCount);
return randomNumber.Next();
}
}
}
Click on any field with an Insert Reference icon, select the Inline Functions tab, and the new inline function should appear in the list.
Can I put multiple functions in the same .dll?
Hi Stephen,
yes you can have as many static functions in the same assembly as you need.
cheers,
Vadim
what sort of things have people used this for?
Hi Cassy,
I've used it in the past to expose from static .Net functions, like Regex.Match or even expose it a little more by wrapping it into my own.
In my example, I found that the Regular Expression actions, when doing in an Extract always returned a collection. In a large workflow I was building, I needed that functionality, and I knew I would only ever get back one piece of text. So I made an Inline function that would do that and I could use it in a Build String action. It let me reduce the size of my workflow a little.
Vadim
thanks Vadim Tabakman​ - it's definitely something to keep in mind.
Hi,
I have performed everything like it is mentioned here
but my function is not working.
i have put it in a Default value of a Text box, instead of running the function it copies the name of the function in the default value of the text box as mentioned in the image.
below is my function and the command have write
namespace IsEnglish
{
public static class Function
{
public static string Is_English()
{
var _lcid = System.Threading.Thread.CurrentThread.CurrentCulture.LCID;
var _lcidUI = System.Threading.Thread.CurrentThread.CurrentUICulture.LCID;
return "LCID: "+_lcid+" LCID-UI: "+_lcidUI;
}
}
}
Command:
Add-InlineFunction -FunctionAlias "fn-CustomIsEnglish" -AssemblyName "IsEnglish, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c559cde2944155fd" -Namespace "IsEnglish " -TypeName "Function" -MethodName "Is_English" -Usage "fn-CustomIsEnglish()" -Description "Returns a lcid"
Has anyone ever tried adding the function (i.e. calling Add-InlineFunction / NWAdmin.exe -o addinlinefunction) by usage of the LCID 1033 instead of no lcid? The outcome (at least in Nintex Workflow 2010) is quite funny...
Yes @lonesurvivor . The handling of languages is somewhat qurky in nintex.
Theese are the rules: