It is strongly recommended to read Getting Started 1: My First Workflow first.

In this article I'll show you how to create conditions in your workflow. Let's create a new workflow, and add a Group Task and a Switch Task to it. Switch Task should be filled like this:

01.png

Now add a Switch Result Task as a dependency to Switch Task. In its Estimated Result field type '1' (Result value of the first switch option). Then add a Call Task to Switch Result and type 'cmd' in Executable File field. And the last step should be adding another Switch Result with estimated result '2' and Call Task with executable name 'notepad'. In the end your workflow should look like this:

02.png

Now run the workflow and watch the console or notepad launch whether you select first or second option.

Note: You can use Switch Result Task after any other task that returns a value. For example, you can write a script and analyze its result. The only (but major) inconvenience here is that Switch Result expects an exact value and not an expression like '%Result% < 0'. This feature will be added eventually.

I hope now you will be able to create more flexible workflows using switches and conditions.

Last edited May 16, 2011 at 7:55 AM by VictorLapin, version 6

Comments

No comments yet.