Nintex Workflow

Nintex Workflow – InStr Inline Function

Finding the position of a piece of text in another piece of text is something I’ve had a need to do for a while now.  It looks like someone else has had that requirement.

So I put together a very simple Inline Function.


This inline function will take 3 parameters

1. Input text

2. Search text

3. Start position where to start searching.

eg. fn-InStr(abcabc,ab,2)


The assembly needs to be added to the GAC (c:\windows\assembly) on all SharePoint farm servers.  If one server is missing the assembly and SharePoint runs a workflow on that server, that Inline Function call will fail.

To install the inline function into Nintex Workflow, you’ll need to run the NWAdmin.exe command line tool.  The following command line will add the inline function to Nintex Workflow.

nwadmin -o AddInlineFunction -functionalias “fn-InStr” -assembly “InStrLib, Version=, Culture=neutral, PublicKeyToken=03c07361705f3bf9” -namespace “InStrLib” -typename “InStrLibMethods” -method “InStr” -description “Finds a piece of text based on a start location.” -usage “fn-InStr(abcabc,ab,2)”

Once you have run this command line, perform an IISRESET.  You will then be able to use this inline function in your workflows.


To call this inline function, you can use the Build String action.  The result will need to be stored in a text variable, then you can use a Convert Value action, if you need to use it as a number.

Build String


 InStr Assembly Download Assembly 

 Workflow : Download Test Workflow

What the Source Code looks like

public static String InStr(String baseString, String findString, int startLocation)
   String result = "";
   int iValue = baseString.IndexOf(findString, startLocation);

   result = iValue.ToString();

   return result;

Leave a Reply