Control datafield and taskfield in quickflow (simpler control of list items and task field values)

Source: Internet
Author: User

Control datafield and taskfield in QF

1) Overview

Datafields and taskfields are two concepts in QF:
Datafields is actually a list item associated with the workflow.
Taskfields indicates the data of a task. Both datafields and taskfield support operations on field values using indexes (datafields ["name.
QF UICodeThe API first supports these two objects. For example, in the executing event, you can use the following code to operate datafields and taskfields:

Workflowcontext. Current. datafields ["title"] = "Some title"; // set list item title in code
String comment s = workflowcontext. Current. taskfields ["body"]; // get task comments

 2) flowchartworkflow. datafields

In the latest release, similar interfaces are also supported in workflow (WF) APIs:
First, the datafields attribute is added to the root activity of the flowchartworkflow workflow. In the active beforerule or afterrule, you can directly use datafields
To get or set the value of the list item field, such:

Beforerule:
This. datafields ["title"] = "Some request title ";
String title = "" + this. datafiels ["title"];

Note: In WFAfter datafields is set, the update is performed only after the activity ends. For example, if datafields is modified in the taskcompleted event of a multi-task activity, the listitem will be updated only when the last task is completed and the whole activity is completed.

To update listitem immediately, you can call this. datafields. Update () method.

 3) task. taskfields

Secondly, the taskfields attribute is added to the task activity. With this attribute, you can control the task field attributes before the task is created. After the task is created, you can obtain the task field values:

Task1.beforerule
This. task1.taskfields ["body"] = "input your comment here .";

Task1.afterrule:
This. datafields ["allcomments"] = "" + this. datafields ["allcomments"] + ";" + this. task1.taskfields ["body"]; // synchronize the value of the task FIELD TO THE LIST ITEM

Another function of taskfields is to use the custom task content type:

QF supports creating a content type under the root site, inheriting from quickflowtaskcontenttype, adding extended fields, editing the taskform attribute of the task activity, and setting the task to be associated with this
Content type. You can use rules to control the value of the task extension field:

Task1.afterrule:
This. task1.taskfields ["requestdate"] = This. datafields ["requestdate"]; // sets the task to display the application information directly.
 

4) multi-task activityTaskfields

Taskfields is also supported for Multitask (ruledriven) after build110714.

Note the following for taskfields:

1-assigning a value to taskfields affects all tasks, and the attributes of all tasks can only be the same

2-When taskfields is used, only the fields of the last valid task can be obtained.
 

5) Note

All field names must use an internal name (internalname)
Before using rule of QF, it is better to understand WF Rule Engine: http://msdn.microsoft.com/zh-cn/library/aa480193.aspx

This feature is available in Versions later than build110714.

Taskfields is supported for multitasking activities after build110724.

This. datafields. Update () method is supported after build120325

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.