Geeks With Blogs
Stuart Brierley Integration Management - BizTalk and More

When creating BizTalk maps you may find that there are times when you need perform tasks that the standard functoids do not cover.  At other times you may find yourself reapeating a pattern of standard functoids over and over again, adding visual complexity to an otherwise simple process. 

In these cases you may find it preferable to create your own custom functoids. 

In the past I have created a number of custom functoids from scratch, but recently I decided to try out the Custom Functoid Wizard for BizTalk 2009.

After downloading and installing the wizard you should start Visual Studio and select to create a new BizTalk Server Functoid Project.

BizTalk 2009 New Project

BizTalk 2009 Custom Functoid Wizard

Following the splash screen you will be presented with the General Properties screen, where you can set the classname, namespace, assembly name and strong name key file.

BizTalk 2009 Custom Functoid Wizard General Properties

The next screen is the first set of properties for the functoid.  First of all is the fuctoid ID; this must be a value above 6000. You should also then set the name, tooltip and description of the functoid.  The name will appear in the visual studio toolbox and the tooltip on hover over in the toolbox.  The descrition will be shown when you configure the functoid inputs when using it in a map; as such it should provide a decent level of information to allow the functoid to be used.

BizTalk 2009 Custom Functoid Wizard Functoid Properties

Next you must set the category, exception mesage, icon and implementation language.  The category will affect the positioning of the functoid within the toolbox and also some of the behaviours of the functoid.

BizTalk 2009 Custom Functoid Wizard Functoid Properties Continued

We must then define the parameters and connections for our new functoid.  Here you can define the names and types of your input parameters along with the minimum and maximum number of input connections.  You will also need to define the types of connections accepted and the output type of the functoid.

BizTalk 2009 Custom Functoid Wizard Functoid Parameters and Connections

Finally you can click finish and your custom functoid project will be created.

BizTalk 2009 Custom Functoid Wizard Final

The results of this process can be seen in the solution explorer, where you will see that a project, functoid class file and a resource file have been created for you.

BizTalk 2009 Custom Functoid Wizard Solution Explorer

If you open the class file you will see that the following code has been created for you:

The "base" function sets all the properties that you previsouly detailed in the custom functoid wizard.

 public TestFunctoids():base()
   int functoidID;
   // This has to be a number greater than 6000
   functoidID = System.Convert.ToInt32(resmgr.GetString("FunctoidId"));
   this.ID = functoidID;

   // Set Resource strings, bitmaps
   SetupResourceAssembly(ResourceName, Assembly.GetExecutingAssembly());

   // Minimum and maximum parameters that the functoid accepts

   /// Function name that needs to be called when this Functoid is invoked.
   /// Put this in GAC.
    "MyCompany.BizTalk.Functoids.TestFuntoids.TestFunctoids", "Execute");

   // Category for this functoid.
   this.Category = FunctoidCategory.String;

   // Input and output Connection type
   this.OutputConnectionType = ConnectionType.AllExceptRecord;

The "Execute" function provides a skeleton function that contains the code to be executed by your new functoid.  The inputs and outputs should match those you defined in the Custom Functoid Wizard.

  public System.Int32 Execute(System.Int32 Cool)
   ResourceManager resmgr = new ResourceManager(ResourceName, Assembly.GetExecutingAssembly());
    // TODO: Implement Functoid Logic
   catch (Exception e)
    throw new Exception(resmgr.GetString("FunctoidException"), e);

Opening the resource file you will see some of the various string values that you defined in the Custom Functoid Wizard - ID, Name, Tooltip, Description and Exception.

BizTalk 2009 Custom Functoid Wizard String Resources

You can also select to look at the image resources.  This will display the embedded icon image for the functoid.  To change this right click the icon and select "Import from File".

BizTalk 2009 Custom Functoid Wizard Image Resources

Once you have completed the skeleton code you can then look at trying out your functoid. To do this you will need to build the project, copy the compiled DLL to C:\Program Files\Microsoft BizTalk Server 2009\Developer Tools\Mapper Extensions and then refresh the toolbox in visual studio.

Posted on Wednesday, May 26, 2010 9:19 AM BizTalk Maps, Mapping and Functoids | Back to top

Comments on this post: BizTalk 2009 - Custom Functoid Wizard

# re: BizTalk 2009 - Custom Functoid Wizard
Requesting Gravatar...
Nice article. The link appears to be broken though.
Left by Charles Storm on Aug 10, 2010 10:30 AM

# re: BizTalk 2009 - Custom Functoid Wizard
Requesting Gravatar...
Thanks for the feedback.

It looks like the link to the 2009 version of the adapter has gone dead, the original 2006 and 2004 versions can be found here however:
Left by Stuart Brierley on Oct 01, 2010 4:06 PM

# re: BizTalk 2009 - Custom Functoid Wizard
Requesting Gravatar...
Hey, I'm going to upload my 2009 functoid wizard soon on my blog, I'll let you know when it's up.

Left by LeandroDG on Apr 04, 2011 4:08 PM

Your comment:
 (will show your gravatar)

Copyright © Stuart Brierley | Powered by: