Sharepoint 2010 : Nintex 2010 custom Inline function
Nintex -as new technology to me- is a nice, easy, and simple workflow engine, that is very useful and fast to learn. and as any other technology there is always a room for expandability.
For me the case was I needed a piece of code to be run often and not only in custom forms, the best approach I have found is to use a custom inline function.
Nintex has several built-in inline functions, and to add extra custom one , lets follow these steps:
- Develop a static class with static function to use as inline function, usually it
will be a class in the Sharepoint project which after deploying it will be registered
in the GAC, otherwise you will have to register it in the GAC (it has been discussed
in previous post) . The resulted code will be something like
this:
namespace Project.TestNameSpace
{
public static class TestInlineFunction
{
public static string Custom_Test_Function(string input)
{
//Do something
return "tested";
}
}
} - Now our dll in the GAC we will need to register the function in Nintex, and to do
so open cmd.exe and use the admin tool Nintex provided for multi-functionalitis,
it is the "WFAdmin.exe" located in [C:\Program Files\Nintex\Nintex Workflow
2010]. Use the followng command to register that inline functoin:
NWAdmin.exe -o addinlinefunction -functionalias "function Name" -assembly "Assembly Name, Version=1.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxxx" -namespace "Class Namespace" -typename "Class Name" -method "Function Name" -usage "Function Name()" -description "Function Description"our sample will be some thing like this:NWAdmin.exe -o addinlinefunction -functionalias "Custom_Test_Function" -assembly "Project, Version=1.0.0.0, Culture=neutral, PublicKeyToken=34396d4d34e57b8c" -namespace "Project.TestNameSpace" -typename "TestInlineFunction" -method "Custom_Test_Function" -usage "Custom_Test_Function(string input)" -description "Testing"
- After registering the inline function it will be available in Nintex inline functions list as below: Note that the function's parameter declaration it was provided, to use this inline function properly.
- And finally, in case you need to remove that inline function, the following command
will do the work as charm:
NWAdmin.exe -o removeinlinefunction -functionalias "Custom_Test_Function"
Hope this blog will help a little in your development life :) have a lovely day :)
Update
a problem had occurred with me when created a function the "object" type parameter, seems the Nintex API does not handle this type.
a problem had occurred with me when created a function the "object" type parameter, seems the Nintex API does not handle this type.
Comments
Post a Comment