Saturday, May 30, 2009

Creating Flowchart Workflow in WF 4.0


Flowchart workflow is a new type of Hybrid workflow in  WF 4.0. In this work flow we can able to use all type of  WF 4.0 activities.

In this Flowchart workflow i am using  FlowDecision activity to make Decision .

Flow Decision  activity contains a Boolean expression Condition. If the expression evaluates to “True”, the true path is executed otherwise, the false path is scheduled


This expressions are written in VB!. This means capitalization does not matter, comparison is performed using a single equals sign instead of “==”, and the Boolean operators are the words "and" and "or" instead of the symbols "&&" and "||". [I think in feature we will able to edit in C#]


Next i am using my Custom activity for to read user input from console . [ please refer my pervious blog post how to create custom activity]



In this  Flowchart workflow i am giving an  example of Bank Account creation.  First i will greet the customer then ask customer to choose what type of account they wanted to create.  Once  customer input is read then using  Flow Decision  activity   i am checking  C for Checking  and S for Saving account.

accType.ToUpper() = "C" [ expression to validate or check user input ]

if Input is C then create checking account and assign customer checking account number print them and say thanks and start the workflow from start.

if Input is  S then ask details for to create a saving account. Here i am asking a questions to customer saying that what is your favorite  Search engine ? B-Bing  & G-Google.  if customer input was B then create a Saving account and assign account number print them and say thanks.  if customer input is G then i print a message saying that "Wait for Google to Open a Bank"

In this project i have defined the following list of variables  as shown below.


Here is the Flowchart workflow in WF 4.0 designer.






1 comment:

Muhammad Arif said...

Can you please do some database interaction with it, and save wf instance and later resume it.. just like leave management system.. when a user request for a leave, his leave must be check in DB, if validated from DB the leave will go to the manager and after his approval the user will be notified that your leave is approved otherwise no approval request will be show to the user