There are two types of workflow Sequential and State Machine, to know more see :Types of Workflows
In this example I will make a Simple State Machine Workflow with Three Infopath forms and Three states. This workflow will take the name of the Approver in Association form,and then When invoked on a Item,displays a Initiation form to add Comments with the item and will create a Task for the Approver/Manager defined in Association form for Approval. If Approver Approve's the task then the workflow is said to be complete or else will be in InProgress.
Contents :
We have Three States in this State machine Workflow.
1) Start State
2) Manager Review State
3) Final State.
And Three Infopath Forms Which are:
1) Association form - For getting the name of Approver.
2) Initilazion form - For adding Comments To the item
3) Task(Review) form - To display for Approval.
Now Lets Get Started, We will first Create an Association, Intitiation and Task Review Form in Infopath 2007.
Steps:
1. Create an Infopath Form,click Design a form and then Choose a Blank Form.
Imp: Make sure that the form is Browser Enabled, i.e the little checkbox displayed below the blank form is checked.
2. Now Design the form with a One table Layout and Name it Association form(You can name it something meaningfull).
3. Now Lets create the DataSource. Firstly double click on myfields and Rename as Main.
4. Add Two Fields Approve and Comments as Text to the Main datasource and drag the Approve field to the form. Create a button “Ok” as below(image).Your Infopath Form looks like this:
So, To do this we added a Comments field here in this form, just to make an Entry for it in Association form Schema.
We will Create a Class file from this Association fom Schema and will add it into our Workflow.
6. Now double click on OK button and Add a rule for it. Then Add Action. In the action dialog, select Submit using a data connection from the dropdown list.Click Add and on the next screen, choose to create a new connection to submit data.
10. Now To create a Class file from association form Schema right click File menu, and chose Save as source.
11. Choose a folder Source(make new folder) and then ok.
12. Now we will create a class file to be used in workflow.
13. Open the Visual studio Command prompt, and move to the path of Source folder.
14. Now write the command xsd myschema.cs /c to generate class file from association form schema.
Lets Create an Initiation form now.
Repeat the first three steps above and then create a single field under Main as Comments.
Drag it on to the form. Create a Submit button from controls and repeate step from 6 to 9.
.bmp)
Last form is the Taks Form/Review Form.
Steps:
Create a form with title “Manager review”.
Now create a dtasource and add a Yes/No filed. This is a checkbox to tell the document is approved. Name the field as Approve.
Create a button ok and repeate stepts 6 to 9 to create a rule for button and finally Save and Publish the form.
.bmp)
We are ready with the Infopath forms Now.
2 comments:
Nice example, but how can you do it without infopath?
where is the visual studio part
Post a Comment