Your first URL external task

Posted: 1 October 2009 in CSSDK, External tasks, Java, Teamsite, URLExternalTask, Worfklow models, Workflows

URL External tasks are useful for running code on the teamsite server as part of your workflow. The task runs in the background ; users don’t get to see what it does and don’t get to interact with the task. If you want your users to interact, such as fill in a form or view progress, consider CGI tasks instead.

On the workflow modeler canvas, add the url external task. You can find it on the toolbar as the kind of world with a cog type of icon. Once you have added the task, you need to update the properties.

The URI property specifies the teamsite servlet that will grab the request the workflow will make on your behalf to go and execute your class on the server. We don’t have to write one, Autonomy already provides on at http://localhost/iw-cc/urlexternaltask. Enter this value as the property.

The next property we need to enter is the variables (in the Task Variables properties section). There we will add variables that can be passed to our Java code. First, we need to pass a variable to the servlet to tell it which class to go and execute. In the Name box, enter “ClassName” (it’s case sensitive and no, do not include the quotes). In the value, enter the fully qualified name of the class to execute, such as “com.acme.workflow.MyClass”.

Link your task and save your workflow. Now we need to create our class that will be executed during the workflow execution.

In the content center toolkit (customer_src/src), create the package directories. In my case, “com/acme/workflow” and in there, create the java source code file for your class, in my case “”.

The class will be executed by the servlet but we don’t get to specify which method it runs.  Instead, we must abide to the interface CSURLExternalTask, which defines the execute method that we must implement.

package com.acme.workflow;
public class MyClass implements CSURLExternalTask {
    public void execute(CSClient client, CSExternalTask task, Hashtable params) throws CSException {
        System.out.println("Hello world");
        task.chooseTransition("link name","transition comment");

the task’s chooseTransition method takes 2 parameters. The first one is the name of the link to transition to the next task. That means your task can make decisions and decide to follow one path of execution over another one during the workflow. If the parameter is an empty string, the workflow engine will transition with the first available link.

The second parameter is the transition comment that the task can leave behind to explain what has happened during its execution.

Compile the class and execute the workflow. In servletd_out.log, your workflow will say hello to you.

  1. Rangitha says:

    I liked your blog. it gives simple idea to work with url external task.
    Can you tell any way to do the following
    1. Set the configurable variable of a urlexternaltask in its java class
    2.Pass the task variable (not a configurable one) in urlexternal task url command
    I will fell great if u help me..

  2. Rathindra says:

    I am new to Teamsite technology. This post is really useful.

  3. I am glad you approve.

  4. Thank you so much for your post. Serves as a guideline.

    I am stuck with the error of “Error reading DTD http://localhost/iw-cc/datacapture6.0.dtd. Message: Connection refused: connect” which is populated in content_center.
    This is a warning but again I cant locate the “Hello world” output as there is no servletd_out.log under iwui.
    Any pointers?

  5. seo says:

    Hey there! This post could not be written any better! Reading
    through this post reminds me of my old room mate! He always kept chatting about this.
    I will forward this write-up to him. Pretty sure he will have
    a good read. Thank you for sharing!

Leave a Reply

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

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