Learn how to add Server Side Extensions to a workflow in ILINX 6.0

ImageSource recently announced the release of ILINX 6.0. The new version of ILINX Capture includes a workflow IXM (ILINX Extension Module) that allows a C# programmer to add their own code to the workflow. As a Sr. Systems Engineer for ImageSource, I would like to give you a quick overview of how to setup and add the code so that you can perform this action yourself.

Once ILINX Capture 6.0 is installed, you should find a subfolder under the install folder (c:\Program Files\ImageSource\ILINX Capture) named “Sample Code”. This subfolder contains a zip file that you can use to unzip the contents to a folder on your hard drive. You can then use the provided Visual Studio shell (Visual Studio Express 2013 for Windows Desktop is free) to open and code/de-bug/build the Server Side Extension. The files listed in the zip file are:

As you can see, there is a solution file that you can open in Visual Studio Express 2013 for Windows Desktop that will allow you to access the layout for each section listed. When you open this file you will get several messages you need to click through since this sample is not installed as part of Visual Studio Express.

Click No:
2Click OK:
3Click OK:
4Close the Internet Explorer Window:
5You should now be on the Visual Studio window and be able to see the various projects under Solution Explorer:

6

You can expand the Solution Explorer tree view for Server Extension:

7

Now we need to set up references to DLL files required for the Server Side Extension to work. Those DLLs are listed below:

8

Next, we need to make sure the versions of the DLLs are the same as the version of ILINX Capture. If the version of ILINX Capture ever changes you will need to update the DLLs listed and re-build and re-load your Server Side Extension. When a new version of ILINX Capture is installed the DLLs can be found in the folder:

C:\program file\ImageSource\ILINX Capture\WFC\BIN

I prefer to create a folder titled “ILINXReferences” and place it in the ILINXSamples folder, (so all sample projects have access to it) then copy the DLLs from the install folder to the ILINXReferences folder.

First, you need to remove the old references using the Solution Explorer:

9

Right click on CaptureDomain and select Remove from the Menu:

10

Do the same thing for CustomCode and WFCContract:

11

In the ServerExtension project, select add new references, browse out to the ILINXReferences folder and select all the DLLs in that folder and add them as references:

1213Tech Tip: If you do not put in the proper references you will not be able to use the code due to undefined objects in your ServerExtension.cs source code.

14

As you can see above, you are now ready to add your code to the ServerExtension template. This method is called “OnBatchProcessing” and is where all your code should start from.

There are some comments that explain how to access some of the batch and document information when using the ImageSource.ILINX.CommonILINX.CaptureDomain.BatchInstance. object. Everything that has to do with a batch or document is in that BatchInstance, ready for your code to interact with depending on what you need to have done in the workflow at this point.

Work with Documents and Document Index Fields:

/// Example: Get the first document in the batch
///    CaptureDocument firstDoc = batch.CaptureDocuments[0];
/// Example: Get the value of a document’s "My Value" index field
///    string theValue = firstDoc.IndexValues.Find(i => i.Name == "My Value").Value;
/// Example: Set the value of a document’s "My Value" index field
///    firstDoc.IndexValues.Find(i => i.Name == "My Value").Value = “some new value”;

Work with Batch Level Fields and how to log information to the log file:

//logger.LogInfo(string.Format("About to rename batch {0}", batch.BatchName));
//batch.BatchName = "new name from server extension";
//logger.LogInfo(string.Format("New name: {0}", batch.BatchName));
//// work with batch indexes - NOTE: require batch has index named "bIndex"
//batch.IndexValues.Find(i => i.Name == "bIndex").Value = "assigned from server extension";

//// work with workflow variables - NOTE: require workflow has variable named "wfVar1"
//logger.LogInfo(string.Format("Workflow variable value is: ", workflowVariables["wfVar1"].Value.ToString()));
//workflowVariables["wfVar1"].Value = "assigned from server extension";

If you need to loop through all the documents in the Batch you would use a Foreach loop as follows:

foreach (CaptureDocument doc in batch.CaptureDocuments)
{
logger.LogInfo("Update Check List: Get the Document Index Fields");
bool clflag;
Boolean.TryParse(doc.IndexValues.Find(i => i.Name == "CLProcessed").Value, out clflag);
string gradlvl = batch.IndexValues.Find(i => i.Name == "GradLevel").Value;
string doctemp = doc.IndexValues.Find(i => i.Name == "DocType").Value;
string docguid = doc.IndexValues.Find(i => i.Name == "DocGUID").Value;
//now log the values read
logger.LogInfo(String.Format("Update CheckList: CLProcessed Flag: {0}", clflag.ToString()));
logger.LogInfo(String.Format("Update CheckList: GradLevel: {0}", gradlvl));
logger.LogInfo(String.Format("Update CheckList: DocType: {0}", doctemp));
logger.LogInfo(String.Format("Update CheckList: DocGUID: {0}", docguid));
}

Once you have your code written and are ready to upload it to the workflow ServerExtension IXM, you need to build your solution:

15

Fix any errors that are reported and build until you get a successful build.

16

Select “File > Save All” before moving on so you won’t lose all the work you have done so far.

Now, you need to zip up the DLL you just built with your code and the other four DLLs used in the references. All five of these DLL files should be in the Bin/Debug folder of your project. Select those five DLLs and add them to a zip folder:

17

Once in ILINX Capture, navigate to the Named Batch Profile you are adding your code into and edit the workflow. Add the ServerExtension IXM and configure it. On the configuration screen, upload the code and navigate out to the folder where your zip file resides. Select the zip file and select “Ok the Upload” and then Save and Publish your workflow changes. You have just added your code to the workflow. You should now be able to test your changes and see the results of your work.

18

19

Now that you know how to add Server Side Extensions to a workflow, I hope you find you have little reason to write your own code using ILINX Capture. The workflow in ILINX Capture is fully capable of doing almost anything you can do in code. However, we all know there will be times when writing code is the only way to get the work done. Fortunately, ILINX Capture provides an interface for doing either or both.

Chris Hillenburg
Sr. Systems Engineer
ImageSource

One thought on “Learn how to add Server Side Extensions to a workflow in ILINX 6.0

  1. Pingback: Elctronic Forms Deployment Considerations | Technical Expertise for ECM

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s