Infopath single form approval process (2)

Source: Internet
Author: User

This article continues with the previous articleArticleDescribes how to allow task operators to directly edit infopath forms when using infopath + quickflow to develop a single form flow.

In the latest quickflow release package, there are two infopath sample files: infopathdocv1.xsn, infopathdocv2.xsn, and infopathdocv1.xsn, which are reserved for compatibility with functions of earlier versions, we recommend that you use the infopathdocv2 format for the new process.

Open infopathdocv2 and right-click "design". A quickflow node is displayed in the form. When the infopath form is displayed on the quickflow task page, the task page is displayed.CodeThe field values under the quickflow node will be controlled. In this case, these fields under the quickflow node usually exist, and the type must be correct.

Descriptions of fields are as follows:

Field

type

usage

readonlyintaskmode

Boolean

set whether the form is read-only on the task page. If you allow the form to be edited on the task page, set this field to false

showdefaulttaskregion

Boolean

set whether to display the default task editing panel. In the previous article, we saw the default task Panel. This is non-infopath content. If you want to design the task panel in infopath, set this field to false

currentstep

string

obtains the current workflow step. If taskstep is set for an activity, it is the value of taskstep. Otherwise, it is the activity name, rules in the form can use this field to obtain the workflow status.

taskmode

Boolean

check whether the current form is in Task Mode. You can view the form on the task editing page. If the task mode is used, the value is true. Otherwise, if you click View form directly in the form library, the value is false. With this field, form rules can control the job mode and view mode using different views.

committask

Boolean

If you hide the default task panel and add the task approval button in infopath, click the rule in the button, you can set this value to false or true to control whether a temporary task is saved or completed.

Formhandler

String

You can directly write code in infopath. But what if you don't want to write code in infopath, and the form processing logic is very complicated? You can customize a class that inherits from quickflow. UI. formservice. infopathtaskformhandlerv2. You can perform various operations on form fields after submitting a task in the class. Compile it into a DLL and deploy it to GAC. then configure the full name of the class in formhandler.

The taskitem subnode under the quickflow node is used to map the task fields. When the form is displayed, each field value under taskitem corresponds to the field of the current task, if the task content type has extended fields, you can also configure them here. The value of the field in taskitem is meaningful only in Task Mode.

Field

Type

Description

ID

Int

Task ID

title

string

task title

outcome

string

obtain or set the task result, that is, the approval result (Pass, recall, etc.). When the task submission button rule sets the value of the committask field to true, the value of this field must be set to the corresponding approval result. Otherwise, the approval result cannot be obtained in the workflow.

comment

string

approval comments. You can drag and drop this field to the form to enter the approval comments

userloginname

string

obtain the task operation user account

username

string

get the task operation User display name

startdate

date and time

Get task start time

completedate

date and time

obtain the task completion time

Status

String

Get task status

The taskhistory subnode under the quickflow node is used to store information about all approval tasks of the process. This node directly references the taskitem node. Operation Method:

Right-click taskhistory and chooseReference..., Browse to the taskitem node, click OK, and then edit the attributes to ensure that the taskhistory/taskitem NodeRepeat allowed.

If you want to display history Approval Information (or others' approval comments) directly in the infopath form, you can drag taskhistory/taskitem directly to the form and display it as a duplicate table. Of course, taskhistory should be read-only, and each field in the table to be setRead-Only.

The above sections explain the usefulness of fields under the quickflow node. We can see that the structure of this node is still very complex. To create a new form, we recommend that you modify the V2 example directly.

Next we will look at how to edit the process in the previous chapter into a form.

When considering this example, I struggled for a few minutes, because the quickflow node is really complicated and I am too lazy to add so many nodes to an existing form, I also don't want to redraw a form, and the V2 in the installation package is based on infopath2010, and infopath07 cannot be opened. My environment is only named sharepoint2007. What should I do?

Fortunately, quickflow is flexible when processing infopath forms. If you have added all the subnodes in quickflow, you can enjoy all the operations on infopath on the quickflow task page, for example, the task field information is automatically synchronized to the taskitem node, and the completed task is automatically accumulated to the taskhistory node. If we do not want these functions, you only need to add several required fields.

Edit the infopath file in the previous chapter and add the following fields: the value of showdefaulttaskregion is true, and the value of readonlyintaskmode is false. Taskitem is an empty group and must exist. Republish the form.

Now, start the process and edit the task. You can see that the form is editable.

So far, the simplest example of allowing the task page to edit infopath has been completed. This example uses a form and a view to display the form as editable on the task page. The default task panel outside the form saves the form and submits the task.

Some may find a small bug ~ How can I edit a task with a submit button? This is left for you to study how to remove it. The prompt is: you can add a rule to the submission rule of the submit button in the form to set the value of a field, for example (issubmit = true ), the identification form has been submitted, and then the condition format (condition format) of the submit button is set. When issubmit = true, hide this button.

This example differs from the implementation of V2 forms. V2 forms display a more complex situation:

    1. Multiple Views are used, and each approval task may have different views (you can control the view to be partially editable). In the form loading rule, different views are switched according to the value of currentstep.
    2. Hide the default task panel, design the task approval page directly in the form, bind the approval comments to the taskitem/Comment field, add rules to each submission button, and control the value of taskitem/outcome to pass the approval result
    3. Display taskhistory/taskitem in a duplicate table.

I believe that by adding the above three points in this article, you will have a thorough understanding of the V2 form. Check whether the next chapter describes the V2 form mode.

Sample download: https://skydrive.live.com/redir? Resid = 7f5a25cdf47d03e6! 1558

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.