Vadim Tabakman

Can you believe there are people out there who actually do real development in VB.net????? I was shocked to tell you the truth. :)

So, during a conversation with a fellow developer, we were discussing how we don't know anyone who does VB.net development. On top that, what if someone wanted to write a Nintex Workflow custom action in VB.net. All the samples in the SDK are in C#.net.

Challenge accepted!

One small hurdle. I'm a C++ and C# developer. I haven't written a single line of code in VB.net. Back in the day, when my friends started learning Visual Basic, I was doing C and C++. This is going to be an interesting task.

Lets start with a checklist :
1. Make sure the Developer Studio has VB.net in it: Check
2. Download the latest Nintex Workflow SDK : Check
3. Start a new VB.net class library project : Check

So the basics are done. Now to start with the simple stuff.
1. Right click on my project, click on Properties and than the Signing tab.
2. Check the "Sign the assembly" and in the drop down select so that we can create a new keyfile to sign the assembly. This is required to add the assembly to the GAC as it needs to be strongly named.

3. Add references to the appropriate files :

Windows SharePoint Services
Windows SharePoint Services Workflow Actions
System.Workflow.Activities
System.Workflow.ComponentModel
System.Workflow.Runtime
Nintex.Workflow
Nintex.Workflow.ApplicationPages (probably optional)
Nintex.Workflow.Resources (probably optional)
Nintex.Workflow.ServerControls

 

I copied the Images folder from the ExecuteSqlAction action the Nintex Workflow SDK. Renamed the images, and changed the images to just be blue boxes. I don't know why I relate VB with the color blue. Wow I think is my moment of synesthesia :). I've been watching too much Heroes.

 

Next was to create/update a NWA file. This will be used with the NWAdmin.exe tool to add the new action to Nintex Workflow. Easy enough. Update the paths, the assembly information, images and their locations etc.


Now that we have these bits in place, we can start coding.

 I added two classes to my project, by right clicking on the project and choosing Add->Class

 
NWAction1VBActivity
NWAction1VBAdapater

The NWAction1VBActivity, I made inherit from the Activity class.

The NWAction1VBAdapater, I made inherit from the GenericRenderingAdapter class.

I decided that for this task, I wouldn't really need the action to do anything. I just wanted to make sure I can make one.

So this action will have one field that a user would fill in when designing their workflow. It's called Fullname. The action will be able to save what the user selected, and allow them to edit it if the workflow with this action is reopened. But during Workflow execution, the action won't actually do anything with this data.

 

I won't go into the actual code, as I am assuming the only people who will look at this article are developers and they'll be able to do that themselves. At the bottom of this article, I'll have a link to the VB.net project. You can download and hack away at it.

To finish this up, once you have compiled the project, you will need to copy the appropriate files to a valid location.

Most likely : C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\NINTEXWORKFLOW\CustomActions

Make a folder called NWAction1VB, and you will need to copy the following files into there :


NWAction1VBDialog.aspx
Images\NWAction1VBIcon.png
Images\NWAction1VBIconSmall.png
Images\NWAction1VBIconWarning.png

Run the NWAdmin tool to add the action to Nintex Workflow :

 NWAdmin -o AddAction -nwaFile [pathToNWAfile]

 Navigate to Central Adminitration->Application Management, and click on Manage Allowed Actions in the Nintex Workflow Management section. Enable the NWAction1VB action and click on OK.

 Now, when you go to a Nintex Workflow enabled site, you can use this new action in the Designer.

 You will see that in the actions panel on the left, the action will appear in the Custom Actions group (and, if you have enabled this, in the Commonly used group).


When you drag the action onto the Workflow designer, you should see a nice birght blue box for the action.


When you go to configure the action, you'll see we only handle one field at the moment


You should be able to click on the "Insert Reference" button to add variables, constants, metadata etc.

 

In Conclusion

 This took me approximately 1.5 hours to make (took me longer to write this article haha). Most of the time was taken searching some of the good sites out there that showed C# syntax and their VB.net equivalent. My issues were mainly my limited knowledge of VB.net syntax. But everything else was pretty straightforward.

 

This has been a fun task to do, and although the action itself is quite simple and doesn't do anything, hopefully this will be userful to someone out there who decides to make a Nintex Workflow custom action and chooses VB.net as their language of choice.

Useful Downloads

Download VB.Net Visual Studio Project

 

Posted by Vadim Tabakman Sunday, February 5, 2012 9:10:00 AM Categories: Custom Action Nintex Nintex Workflow
Copyright Vadim Tabakman
Rate this Content 0 Votes

Comments

Tuesday, May 20, 2014 2:38:54 AM
shardul Pasare
Gravatar

Log in nintex history list

Hi Tabakam,

         We have created nintex custom activity. Requirement is to log message into nintex history list. Can you please provide if any way is there to log into nintex history list.

We able to log into history list of designer as follow.

LogHistory(executioncontext, base.workflowInstanceID, microsoft.sharepoint.workflow.SPWorkflowHistoryEventType.workflowError, Error)

How to achieve same for nintex

You must sign in to this site to post comments.
Already Registered?
Sign In
Not Yet Registered?
Register

Statistics

  • Entries (279)
  • Comments (1769)

Categories