This article will give a concentrated explanation of the problems frequently encountered by quickflow developers.
1) What is quickflow?
Quickflow is a workflow design tool based on SharePoint (2007,2010). It contains a core flowchart flow model andCodeDesigner. Developing a Sharepoint Workflow Based on quickflow is similar to developing a workflow directly on SharePoint. Before using quickflow, you 'd better know how to develop and run the default SharePoint workflow.
For more details, see: http://cid-7f5a25cdf47d03e6.office.live.com/view.aspx/QuickFlow/Docs/QuickFlow2.0%E7%99%BD%E7%9A% AE %E4%B9%A6.docx
2) how to install quickflow
Quick flow installation includes two parts: one part is a WSP solution, which includes all DLL files and page files. This WSP is in two versions: one for sharepoint2007, one user, sharepoint2010. The other part is the designer. The designer does not need to be installed. After decompression, the EXE file can be opened. It should be noted that the current version of the designer can only run on the Sharepoint Server.
See http://cid-7f5a25cdf47d03e6.office.live.com/view.aspx/QuickFlow/Docs/QuickFlow%E5% AE %89%E8%A3%85%E6%8C%87%E5%8D%97.docx for details
3) how to solve errors encountered during quick flow usage
There are several types of errors:
Release Process:This error occurs. Generally, the Web. config configuration is incorrect. reactivate quickflow feature. In sp07, perform operations in website set function management. In sp10, activate quickflow app Configuration feature in the Management Center. For details, see the installation documentation.
When the workflow is running:There are many possibilities. First, you need to find the log information, which can be viewed in two places. One is the workflow status page -- On the list page, click the workflow link to enter. On this page, you can see the internal logs output by quickflow. You can view the information on this page not only when you encounter an error, but the running result is inconsistent with the expected result. For example, if an email is set to be sent but is not received during the test, the status page records the email discovery status.
The other place for viewing logs is the 12/logs or 14/logs Directory, which is the built-in log file of SP. Open the latest log file and search for workflow infrastructure. You can find the log information related to the workflow.
Note: log directory [c: \ Program Files \ common files \ microsoft shared \ Web Server Extensions \ 14 \ logs]
An error occurred while submitting the page:At this time, if no detailed error information is found on the page, first let the SP display the detailed error. This operation is the first step of SP development. Detailed error: Google SharePoint detailed error. It should be noted that the web. config in layouts also needs to be modified (set customerror mode = 'off ')
4) workflow Variables)
When quickflow designer is used, workflow variables allow certain types of fields to be added at the process level. The attributes of each activity can be bound to workflow variables, and the UI code can directly control the values of workflow variables.
If you use Visual Studio + quickflow for development, you do not need to use workflow variables. workflow variables are used to simulate field addition ). When vs is used, you can easily add fields to the workflow. Why do you need to use workflow variables?
Of course, workflow variables in vs can still be used, so there are two problems:
A) how to control the workflow field value in the UI code: it is the same as controlling the workflow variable value, with quickflow. core. workflowcontext. current. updateworkflowvariable ("nextapprovors", nextusers );
B) how to control the workflow variable value in the WF code: simply set the field value, or use base. updatevariable ("nextapprovors", nextusers); for example:
Public quickflow. namecollection nextusers;
// Nexusers bind to multitask. Users
Private void task_init (Object sender, eventargs E)
{
This. nextusers = ...;
// Or base. updatevariable ("nextusers", nextusers );
}
Remember:
When Vs + QF is used, workflow variables are the same as common fields.
Never call workflowcontext. Current in vs's WF code.
To pass the variable value in the UI code, it is only feasible in several fixed event methods:
1-startworkflowbutton.executing event,
2-actionsbutton.actionexecuting event,
3-taskreassignbutton.executing event,
4-in the page_load event on the startup page or task page, after assigning a value to the workflow variable in page_load, the workflow must be started or submitted in the following operations.
In any method, you must use quickflow. Core. workflowcontext. Current. updateworkflowvariable to update the variable.
Note: In the UI code, you can only set the value of the workflow variable but not the value of the workflow variable. If you need to obtain the workflow variable, you can use the list field to pass the value.
5) about workflowcontext. Current
This class is used inWorkflow pageTo interact with the workflow. Non-workflow pages cannot be used.
6) If you do not need the control provided by quickflow to develop the workflow page, how can you start the process and submit the task?
There are two methods:
A) directly use the SharePoint object model. This is complicated.
Methods related to workflow include spsite. workflowmanager. startworkflow and spworkflow. altertask. For details, see SharePoint SDK.
B) Use the API operation provided by quickflow: workflowcontext. Current.
Workflowcontext. Current must be used in a specific context, including the list creation page and task submission page.
Common workflowcontext methods are as follows:
| Workflowcontext. Current |
Obtain the current workflow Context |
| Workflowcontext. createcontext (splist datalist) |
Creates a context based on a list. When an automatic workflow is created, a list item is automatically created in the list for starting a workflow on a non-newform page. |
| . Datafields [] |
Obtains or sets the value of the List field. |
| . Updateworkflowvariable (string name, object value) |
Update workflow variables before workflow startup or before task submission |
| . Startworkflow (string wfname) |
Start Workflow |
. Committask (string outcome) |
Complete the task and specify the result of the task (Pass, reject) |
| . Reassigntask (string) |
Forwarding task |
| Workflowcontext. Current. Task |
Obtain the current workflowtask (only the last data can be obtained) |
| Workflowcontext. Current. taskfields ["field name"] |
Obtains the attribute of the current task field to obtain the latest data. |
Workflowtask class is required for task submission
Workflowtask generally uses workflowcontext. Current. task (Task page Code) orWorkflowtask. Fromlistitem (anywhere) Get
Common workflowtask methods are as follows:
| Workflowtask. fromlistitem |
Convert a task item to a workflowtask class |
| . Actions |
Taskactions) |
| Bool cancommit () |
Can the current user submit a workflow (only the website administrator or task operator can submit a task) |
| Committask (string outcome) |
Submit a task |
| |
|
Example:
Start the workflow on the newform page of the list:
Workflowcontext. Current. startworkflow ("My workflow ")
Workflow variables can be passed whether to start a workflow or before submitting a task.
Workflowcontext. Current. updateworkflowvariable ("vabiablename", value)
Start the process on a common ASPX page (non-newform page ):
VaR wflist = spcontext. Current. Web. Lists ["list1"];
Workflowcontext wfctx = workflowcontext. createcontext (wflist );
Wfctx. datafields ["title"] = proj. projectname; // set the list item Field
Wfctx. datafields ["referenceno"] = proj. referenceno;
Wfctx. datafields [projectid_fieldname] = proj. ID;
Wfctx. updateworkflowvariable ("sendtopccontroller", true); // set workflow Variables
Wfctx. updateworkflowvariable ("pccontroller", new namecollection (pccontroller ));
Wfctx. updateworkflowvariable ("PM", new namecollection (proj. productmanager ));
Wfctx. startworkflow (config. workflowname );
Obtain the task action on the task page:
Taskactioncollection actons = workflowcontext. Current. task. actions;
Complete the task on the task page:
Workflowcontext. Current. committask ("approved"); // approved is a taskaction
Complete the task on a non-task page, such as the console or timerjob code:
VaR taskitem = tasklist. getitembyid (100 );
VaR task = workflowtask. fromlistitem (taskitem );
If (task. actoins. Count> 0) task. Commit (task. Actions [0]);
Else taks. Commit ();
7) Can the rich text box commenttaskfield remove its style, that is, users do not want to add various styles in the approval comments, as long as the text comments are entered?
In website content type management, locate the task content type and set its description field to not use Rich Text
8) Why does the initialized event fail to take effect if the attribute of the activity is set in the initialized event?
Because the activities in QF can be executed infinitely, the actually executed activities are only copies of the activities on the designer.
If the activity has been executed, setting the activity attribute on the designer may be invalid.
There are two ways to solve this problem:
1 -- the event parameter sender is always an activity in progress and is assigned a value directly to the sender, for example, (task) sender). User = "someuseraccount ";
2 -- if you want a property to be modified during activity execution, you can bind it to a global variable so that it can always be modified.
3 -- assign a value to the field of the activity in the completed event of the previous activity.
9) when the Rule Engine (beforerule or afterrule) is set, it is found that the workflow does not end for a long time.
Cause: Rule calculation changes the condition of the rule, causing the rule engine to re-run the rule (resulting in an infinite loop)
Solution: Change the recomputing option to never (never), learn about WF Rule Engine: http://msdn.microsoft.com/zh-cn/library/aa480193.aspx
10) the task is locked. Even if the code error is corrected, the task cannot be submitted again.
Solution: Unlock the task and submit it again:
Servermodel code:
Using (spsite site = new spsite ("http: // localhost") {using (spweb web = site. openweb () {splist tasklist = web. lists ["tasks"]; var item = tasklist. getitembyid (188); // change 188 to the task id web. allowunsafeupdates = true; item [spbuiltinfieldid. workflowversion] = 1; try {item. systemupdate ();} catch (exception ex) {console. writeline (ex. tostring ());}}}
Clientmodel code:
Try
{
Using (Clientcontext = New Clientcontext ( " Http: // localhost " ))
{
Web Site = Clientcontext. Web;
VaR list = Site. Lists. getbytitle ( " Tasks " );
Listitem item = List. getitembyid ( 188 );
Clientcontext. Load (item );
Clientcontext. executequery ();
Console. writeline ( " Workflowversion: " + Item [ " Workflowversion " ]);
Item [ " Workflowversion " ] = 1 ;
Item. Update ();
Clientcontext. executequery ();
}
}
Catch (Exception E)
{
Console. writeline (E. tostring ());
}
Console. writeline ( " Done " );
Console. readkey ();
Note: after the latest version of the task is locked, an unlocked link will be displayed on the default task page. If it is a custom page, add the unlocktasklink control to the page.
If the task cannot be submitted after unlocking, restart the SharePoint timer service and database service, and then unlock and submit again. If the task persists, you can only restart the workflow.
Ref: http://connect.nintex.com/forums/thread/6503.aspx
11) How do I transmit workflow variables when I start a workflow directly using a pure Moss interface instead of using quickflow APIs?
Code entry:
// Using qukckflow. core;
Workflowvariablevalues Vs = new workflowvariablevalues ();
Vs ["variablename1"] = "value1 ";
Vs ["variablename2"] = "value2 ";
VaR eventdata = serializeutil. serialize ();
Spsite site = spcontrol. getcontextsite (httpcontext. Current );
VaR wfname = "Some workflow name ";
VaR wfass = List. workflowassociations. getassociationbyname (wfname, system. Globalization. cultureinfo. currentculture );
WF = site. workflowmanager. startworkflow (listitem, wfass, eventdata );
To start the workflow asynchronously, you can call:
Site. workflowmanager.Startworkflow(
CTRL + Click to open in new tab. "href =" http://www.aisto.com/roeder/dotnet/Default.aspx? Target = Code: // mscorlib: 2.0.0.0: b77a5c561934e089/system. Object ">ObjectContext,
CTRL + Click to open in new tab. "href =" http://www.aisto.com/roeder/dotnet/Default.aspx? Target = Code: // Microsoft. SharePoint: 14.0.0.0: 71e9bce111e9429c/Microsoft. Sharepoint. workflow. spworkflowassociation ">SpworkflowassociationAssociation,
CTRL + Click to open in new tab. "href =" http://www.aisto.com/roeder/dotnet/Default.aspx? Target = Code: // mscorlib: 2.0.0.0: b77a5c561934e089/system. String ">StringEventdata,
CTRL + Click to open in new tab. "href =" http://www.aisto.com/roeder/dotnet/Default.aspx? Target = Code: // Microsoft. SharePoint: 14.0.0.0: 71e9bce111e9429c/Microsoft. Sharepoint. workflow. spworkflowrunoptions ">SpworkflowrunoptionsRunoptions)
This asynchronous method is only supported by sp2010.
12) If the workflow is set to auto, an error will be reported when you start the workflow with startworkflowbutton.
First, we need to understand the default workflow mechanism of MOSS: The workflow can be started in three modes:
1) Manual start-start the workflow from the drop-down menu
2) automatic start -- Automatic after an item is created
3) Start when a field value of item changes
When startworkflowbutton is used, startworkflowbutton calls the moss API to start the workflow. In fact, it simulates manual start.
If it is set to automatic, moss automatically starts a workflow, and startworkflowbutton starts a workflow again.
However, one job cannot be started twice. Therefore, an error occurs when startworkflowbutton starts the workflow.
Therefore, if startworkflowbutton is used or the moss API is called in other ways to start a workflow, the workflow must be set to manual start (Manual)
13) The task history list on the sp10 task form displays a check box. How do I cancel this check box?
Modify the default view settings of the task list. deselect the: allow individual item checkboxes check box.
14) a workflow variable is created in QFD, but this variable cannot be found in the activity property binding window or rule editing window.
Click the Save button to save the workflow.
15) after the re-release process, the process name appears (1)
Cause: the reason is that the baseid of the Process configuration file changes when the old version of QFD is released.
Solution: upgrade to the latest version of QFD, open the workflow folder with SharePoint designer, and delete versions except version 1.0 and current versions of. xoml. wfconfig. xml,
Then, modify the baseid in the latest version. xoml. wfconfig. XML to be consistent with Version 1.0.
16) how to control the fields displayed in workflowhistory/tasklist
In a custom task form, you can use the viewfields control of the workflowhistory control, for example:
<Qfl: workflowhistory runat = "server" id = "hislist" showtaskofcurrentworkflow = "true"
Viewfields = "" title, assignedto, status, body, startdate, workflowoutcome, delegatefrom "/>
To control the tasklist page that comes with QF, go to website Settings> website Bar management and add the fields to be displayed to the quickflow group.
17) ruledriven/taskwizard has set a timeout rule and does not work.
1-Restart IIS, Sharepoint timer service, and Server
2-set the scheduled job scan interval: stsadm-O setproperty-propertyname "job-Workflow"-propertyvalue "every 2 minutes between 0 and 59"-URL http: // dc
3-Reference: http://www.dev4side.com/community/blog/2010/12/1/bug-using-delay-activity-on-sharepoint-2010-workflow.aspx
18) when using Vs + QF to develop a workflow, if it is already deployed in the production environment, how can we update it to ensure that the old process runs normally?
If you only modify the internal code of the method, update the DLL or WSP normally.
If activity or variable is added or deletedProgramUpgrade the Assembly, manually back up the old assembly, update the new assembly or WSP, and re-deploy the old Assembly to ensure that the new and old Assembly both exist in the GAC
See:Http://spmat.blogspot.com/2010/11/assembly-versioning-for-sharepoint.html