Working with inline functions

You can create your own custom inline functions, which can be used anywhere that a workflow reference can be added, in Nintex Workflow 2013.

Developing inline functions

From a development perspective, an inline function is a public static method, contained in a public static class. The static method must meet the following requirements to be used as an inline function:

Defining inline functions

To avoid duplicate names for inline functions, each inline function must have at least one corresponding function alias. An alias is assigned to an inline function at the time the inline function is registered with Nintex Workflow 2013 export (.nwp) file. The function aliases for all inline functions, including custom inline functions, are stored in the configuration database.

More than one alias can be assigned to a single static method, if desired, for discoverability or localization purposes. For example, if you want to provide locale-specific descriptions for your inline function, you can add an alias for each locale ID, with locale-specific information.

The AddInlineFunction operation provided by the NWAdmin.exe command line tool is used to define an alias for a custom inline function for Nintex Workflow 2013. For example, the following command defines a function alias, fn-IsWeekend, for the IsWeekend static method of the DateInlineFunctions static class included in the CustomInlineFunctions sample.

NWAdmin.exe -o AddInlineFunction -functionalias fn-IsWeekend -assembly "CustomInlineFunctions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0954cd99b2e327d9" -namespace "Nintex.Samples" -typename DateInlineFunctions -method IsWeekend -usage "fn-IsWeekend(dateToCheck)" -description "Indicates whether the specified date represents Saturday or Sunday."

You can use the EnumInlineFunctions operation provided by NWAdmin.exe to confirm that the function aliases for your custom inline functions are successfully defined in the configuration database, or the DeleteInlineFunction operation to remove a function alias from the configuration database.

Caution: Use the DeleteInlineFunction operation carefully. The DeleteInlineFunction operation can remove any function alias, including function aliases defined by Nintex Workflow 2013. Removing a function alias deletes the function alias from the configuration database, making the inline function unavailable to Nintex Workflow 2013, but does not remove the corresponding assembly from the GAC.

For more information about the NWAdmin.exe command line tool, see NWAdmin Operations - Nintex Workflow 2013.

Invoking inline functions

Unlike other workflow references, such as workflow variables, inline functions are not framed in curly brace ({}) characters, nor are they formatted differently. Instead, Nintex Workflow 2013 uses a regular expression, based on each function alias stored in the configuration database, to parse the value a of configuration setting when the AddContextDataToString method is invoked. If a matching function alias for an inline function is found, Nintex Workflow 2013 attempts to parse and evaluate the syntax for the inline function from the value of the configuration setting.

The following syntax declaration defines the expected syntax of an inline function in the value of a configuration setting, where <Prefix> is the function prefix, <Alias> is the function alias, and <Parameter> is an optional parameter value:

<Alias>( [<Parameter>,...] )

<Parameter> can accept either parameter values or other inline functions, and inline functions can be nested within each other. Double quote (") characters can be used to frame string values, to ensure that a value can be correctly parsed from text as a string, but are not required.

For example, the following string represents the value for the Text configuration setting for a Build string workflow action in a workflow. The value uses the fn-IsWeekend custom inline function, defined in the previous example, to check whether two dates fall on a Saturday or Sunday:

7/28/2015 is a weekend day: fn-IsWeekend("7/28/2015")

8/1/2015 is a weekend day: fn-IsWeekend("8/1/2015")

When successfully executed, the workflow action returns the following string:

7/28/2015 is a weekend day: False

8/1/2015 is a weekend day: True

See Also

Concepts

Inline functions

Workflow references

Reference

.NET Framework Reference