Nintex Workflow – Custom Inline Function


Hi everyone. Today I want to show you how you can develop custom inline functions for the Nintex Workflow product for SharePoint.

I got the idea from here (Absolutely great post.) but I created a SharePoint solution file because I thought this would be a bit simpler to use.

First open Microsoft Visual Studio and create a new Empty SharePoint Project. Remember to deploy it as a farm solution.

nintex_custom_inline_new_sharepoint_project

Now add a new Class. I called mine “Function.cs”.

nintex_custom_inline_code

Here is some example code I added to my class. (I got the code also from here.)

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

namespace CustomNintexInline
{
class Function
{
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);
}
}
}

Now build your project.

After you successfully built your project run cmd as Administrator and go to the following path:

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin

Next run the following code to retrieve the Public key token:

sn.exe -T "Path-To-Your-dll/Project.dll"

Write down the value of your Public key token you will need it later.

nintex_cutom_inline_sn

Next you need to add your solution file to your SharePoint Farm. Do this by running PowerShell as Administrator and by running the following commands:

Add-PSSnapin Microsoft.SharePoint.PowerShell
Add-SPSolution "Full-Path-To-Your-WSP/Project.wsp"

nintex_custom_inline_add_solution

Next open your SharePoint Central Administration and deploy your solution globally.

nintex_custom_inline_solution

Next go to:

C:\Program Files\Nintex\Nintex Workflow 2010

Now run cmd as Administrator and run the following code to add your custom inline function to your Nintex Workflow product:

NWAdmin.exe -o addinlinefunction -functionalias "fn-Random (The string alias used to use your function later in your workflows)" -assembly "CustomNintexInline, Version=1.0.0.0,  Culture=neutral, PublicKeyToken=<Value you retrieved before by using sn.exe> (dll data)" -namespace "CustomNintexInline (Namespace of your Project)" -typename "Function (Class of your Project containing your function)" -method "Random (Method/Function name in your Project)" -description "<A short description what your function does>" -usage "<How to use your function>"

If the above command finishes without error messages your custom inline function has been successfully added to your Nintex Workflow product.

nintex_custom_inline_nwadmin

Next run cmd as Administrator and run the following command to restart IIS:

iisreset

That´s it. Now your custom inline function should be available. To test it I created a simple Nintex Workflow:

nintex_custom_inline_test_workflow

When you go to Inline Functions in one of your Nintex Workflow Actions you will find your custom inline function. (Called “Random” in my example)

nintex_custom_inline_use

Here you can see the result of my Test workflow:

nintex_custom_inline_test_mail

As you can see everything worked as expected and your custom inline function is ready to use. I hope you liked my today´s post. See you next time.

As always you can download my code from here.

Sources:

http://www.vadimtabakman.com/nintex-workflow-developing-a-custom-inline-function.aspx

Advertisements
Tagged ,

One thought on “Nintex Workflow – Custom Inline Function

  1. ysrysmwtq says:

    Nintex Workflow – Custom Inline Function | theezitguy
    aysrysmwtq
    [url=http://www.gunic2j80st45wqm24b0m7502g5i233vs.org/]uysrysmwtq[/url]
    ysrysmwtq http://www.gunic2j80st45wqm24b0m7502g5i233vs.org/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: