SharePoint Designer - Workflow
另一篇文章 SharePoint 2013 - Designer Workflow
1. Set field in current item : 不要连续多次使用,否则在发布时会出现unexpected error;当需要同时更新几个字段时,使用update list item。
2. Error:
(1)Errors were found when compiling the workflow. The workflow files were saved but cannot be run. Unexpected error on server associating the workflow。
--------http://support.microsoft.com/kb/2557533
3. Wait for Field Change in Current Item: 可使用此活动将工作流停顿在某一步;
4. 获取InfoPath的文件名(含扩展名)时,可以用 'Name (for use in forms)',或者Title属性,但不要使用Name属性,因为Name属性不包含扩展名;
5. Email 模板
<head><style>TABLE.mail { border-style:none; border-collapse:collapse; font:8pt Tahoma; width:100%; }TD.header { background:#F8F8F9; border:1px solid #E8EAEC; padding:12pt 10px 4pt 10px; }TD.body { padding:12pt 10px 24pt 10px; }TD.footer { border-width:1px; border-style:solid none none none; border-color:#9CA3AD; padding:4pt 10px 4pt 10px; }A { text-decoration:none; }DIV.title { font:16pt Verdana; }DIV.headertext { margin:5px 0px 0px 0px; }DIV.error { font-weight:bold; }DIV.comment { color:#9CA3AD; }SPAN.wfname { font:bold italic; }.headertop1 { width: 100%;}.headercontent { color: #000000; font-family: verdana; font-size: 16pt;}.headercontent em { font-weight:bold;}.breadcrumb td { padding-left: 2px; padding-right: 2px;}.breadcrumb a{ font-family: tahoma; font-size: 8pt;}.content { margin-top:6px; width: 100%; border-bottom:solid 1px #9ca3ad;}.toolbar { border: 1px solid #e8eaec; background-color: #f8f8f9; padding-top:3px; padding-bottom:6px; padding-right:3px; padding-left:3px;}.toolbarbutton a, .toolbarsep { font-family: verdana; font-size: .68em; padding-left: 3px; padding-right: 3px;}.toolbarbutton a{ text-decoration: none;}.toolbarsep { color:#c7cbd1;}.spacer { height: 10px; font-size: 1px; line-height: 1px;}.formline, .noheight { height: 1px; font-size: 1px; line-height: 1px;}.formlabel, .formbody, .digestlabel, .altdigestlabel, .deletedlabel, .altdeletedlabel { font-family: tahoma; font-size:8pt; padding: 0px 7px 0px 7px; vertical-align: top;}.formlabel, .digestlabel, .altdigestlabel, .deletedlabel, .altdeletedlabel { color: #616a76; font-weight: bold; }.rulerow { border-bottom:solid 1px #9ca3ad; height:0px; font-size:1px; line-height:0px;}.digestlabel a, .altdigestlabel a {}.digestlabel a:hover, .altdigestlabel a:hover {}.formbody { color: #000000;}.edited{ text-decoration:line-through; color:#9ca3ad;}.descriptiontext { color: #9ca3ad; font-family: tahoma; font-size: 8pt; padding-top:5px; padding- bottom:7px;}.formline { border-bottom: 1px solid #D7DEAC;}.editedicon, .newicon, .deletedicon { color:#000000; font-family: Small Fonts, Tahoma, Verdana, Sans Serif; font-size: 7pt; padding-top:0px; padding-right:3px; padding-bottom:1px; padding-leftt:2px; position: relative; top:2px; margin-right:8px; margin-left:8px; font-weight:normal;}.editedicon { background-color:#ffffcc;}.newicon { background-color:#b1faa2;}.deletedIcon { background-color:#ffcccc; }.messagespace { color: #5D6437; font-family: tahoma; font-size: 8pt; padding-top:5px; padding-bottom:7px;}.editedexample { background: #FFFFBF; padding:1px;}.vh, .vb, .altvb, .deleted, .altdeleted{ font-weight: normal; text-align: left; text- decoration: none; vertical-align: top; font-size: 8pt; font-family: tahoma, sans-serif; padding-left: 5px; padding-right: 8px;}.vb, .altvb, .deleted, .altdeleted, .digestlabel, .altdigestlabel, .formlabel, .formbody { border-bottom:solid 1px #e8eaec; padding-top:2px; padding-bottom:5px;}.vb div.nobr, .altvb div.nobr { white-space:nowrap;}.vh { color:#76808e; font-weight:bold; padding-top:7px; padding-bottom:6px; white-space:nowrap;}.vb, .altvb { color:#616a76;}.altvb, .altdigestlabel, .altdeleted, .altdeletedlabel, .formlabel, .formbody { background: #f8f8f9; }.digesttext { color: #000000;}.deleted, .deletedlabel, .altdeleted, .altdeletedlabel { text-decoration: line-through; color:#9ca3ad;}.deleted a, .altdeleted a { color:#9ca3ad; text-decoration:line-through;}</style></head><body><table cellpadding="2" cellspacing="0" class="mail" DIR="none"><tr class="header"><td class="header"><div class="title"><font size="2">[%Current Item:申请人姓名%],您好。<br><br>您借的产品 <a href="[%Public_Values:.../DispForm.aspx?ID=[%Current Item:ID%]">[%Current Item:产品名称%]</a> 已经到期,请尽快归还。谢谢配合! </font></div></td></tr><tr class="body"><td> </td></tr><tr class="footer"><td class="footer"></td></tr></table><table class="content" cellspacing="0" cellpadding="0"><tr><td colspan=3 class="descriptiontext"> Detailed Information</td></tr><tr><td class="formlabel"><font size="2">产品名称</font></td><td class="formbody"><font size="2"> [%Current Item:产品名称%] </font></td><td class="altvb"> </td></tr><tr><td class="formlabel">Product Category:</td><td class="formbody"><font size="2"> [%Current Item:Product Category%] </font></td><td class="altvb"> </td></tr><tr><td class="formlabel"><font size="2">开始日期:</font></td><td class="formbody"><font size="2"> [%Current Item:开始日期%] </font></td><td class="altvb"> </td></tr><tr><td class="formlabel"><font size="2">结束日期:</font></td><td class="formbody"><font size="2">[%Current Item:结束日期%] </font></td><td class="altvb"> </td></tr><tr><td colspan=3 class="descriptiontext"> Last Modified [%Current Item:Modified%]</td></tr></table></body>
界面为:
6. 在同一站点下将含有工作流的文档库或列表保存为模板并新建,工作流也会存在于新建的Library/List中,但可以再List Settings的Workflow Setting中移除工作流和列表的关联,而且不会影响到原有的列表;
7. SharePoint 2013 Workflow中的Start a List Workflow 和 Start a Site Workflow都只能用于启动SharePoint 2010 Workflow,但主工作流会等待子工作流结束后再往下继续运行;
8. List Form中的People Picker控件,如果不填任何信息,直接使用这个字段发邮件(CC中),会出错;但Library Form中的People Picker字段,如果不填任何信息,直接在邮件抄送中使用,不会出错;
Library Form中的People picker允许多选时,得到的account是 域名\登录名 的格式,在邮件中使用时不能验证;但单选时不会出现这个问题;但是尽量不要使用带有域名的账号去发邮件;
9. 在使用 Start Approval Process 生成审批任务时,需要对其进行修改,使其更合理,一般会对任务邮件内容进行修改,删除其它邮件,具体可参考此处;
10. 邮件格式可参考以下内容:
<head><style>TABLE.mail { border-style:none; border-collapse:collapse; font:8pt Tahoma; width:100%; }TD.header { background:#F8F8F9; border:1px solid #E8EAEC; padding:12pt 10px 4pt 10px; }TD.body { padding:12pt 10px 24pt 10px; }TD.footer { border-width:1px; border-style:solid none none none; border-color:#9CA3AD; padding:4pt 10px 4pt 10px; }A { text-decoration:none; }DIV.title { font:16pt Verdana; }DIV.headertext { margin:5px 0px 0px 0px; }DIV.error { font-weight:bold; }DIV.comment { color:#9CA3AD; }SPAN.wfname { font:bold italic; }.headertop1 { width: 100%;}.headercontent { color: #000000; font-family: verdana; font-size: 16pt;}.headercontent em { font-weight:bold;}.breadcrumb td { padding-left: 2px; padding-right: 2px;}.breadcrumb a{ font-family: tahoma; font-size: 8pt;}.content { margin-top:6px; width: 100%; border-bottom:solid 1px #9ca3ad;}.toolbar { border: 1px solid #e8eaec; background-color: #f8f8f9; padding-top:3px; padding-bottom:6px; padding-right:3px; padding-left:3px;}.toolbarbutton a, .toolbarsep { font-family: verdana; font-size: .68em; padding-left: 3px; padding-right: 3px;}.toolbarbutton a{ text-decoration: none;}.toolbarsep { color:#c7cbd1;}.spacer { height: 10px; font-size: 1px; line-height: 1px;}.formline, .noheight { height: 1px; font-size: 1px; line-height: 1px;}.formlabel, .formbody, .digestlabel, .altdigestlabel, .deletedlabel, .altdeletedlabel { font-family: tahoma; font-size:8pt; padding: 0px 7px 0px 7px; vertical-align: top;}.formlabel, .digestlabel, .altdigestlabel, .deletedlabel, .altdeletedlabel { color: #616a76; font-weight: bold; }.rulerow { border-bottom:solid 1px #9ca3ad; height:0px; font-size:1px; line-height:0px;}.digestlabel a, .altdigestlabel a {}.digestlabel a:hover, .altdigestlabel a:hover {}.formbody { color: #000000;}.edited{ text-decoration:line-through; color:#9ca3ad;}.descriptiontext { color: #9ca3ad; font-family: tahoma; font-size: 8pt; padding-top:5px; padding- bottom:7px;}.formline { border-bottom: 1px solid #D7DEAC;}.editedicon, .newicon, .deletedicon { color:#000000; font-family: Small Fonts, Tahoma, Verdana, Sans Serif; font-size: 7pt; padding-top:0px; padding-right:3px; padding-bottom:1px; padding-leftt:2px; position: relative; top:2px; margin-right:8px; margin-left:8px; font-weight:normal;}.editedicon { background-color:#ffffcc;}.newicon { background-color:#b1faa2;}.deletedIcon { background-color:#ffcccc; }.messagespace { color: #5D6437; font-family: tahoma; font-size: 8pt; padding-top:5px; padding-bottom:7px;}.editedexample { background: #FFFFBF; padding:1px;}.vh, .vb, .altvb, .deleted, .altdeleted{ font-weight: normal; text-align: left; text- decoration: none; vertical-align: top; font-size: 8pt; font-family: tahoma, sans-serif; padding-left: 5px; padding-right: 8px;}.vb, .altvb, .deleted, .altdeleted, .digestlabel, .altdigestlabel, .formlabel, .formbody { border-bottom:solid 1px #e8eaec; padding-top:2px; padding-bottom:5px;}.vb div.nobr, .altvb div.nobr { white-space:nowrap;}.vh { color:#76808e; font-weight:bold; padding-top:7px; padding-bottom:6px; white-space:nowrap;}.vb, .altvb { color:#616a76;}.altvb, .altdigestlabel, .altdeleted, .altdeletedlabel, .formlabel, .formbody { background: #f8f8f9; }.digesttext { color: #000000;}.deleted, .deletedlabel, .altdeleted, .altdeletedlabel { text-decoration: line-through; color:#9ca3ad;}.deleted a, .altdeleted a { color:#9ca3ad; text-decoration:line-through;}</style></head><body><table cellpadding="2" cellspacing="0" class="mail" DIR="none"><tr class="header"><td class="header"><div class="title"><font size="2">[%Current Task:Assigned To%],您好。<br><br>新的XXXX申请<A HREF="[%Task Process:Web URL%]/[%Task Process:Item URL%]">[%Task Process:Item Title%]</A>等待您的审批。谢谢配合! </font></div></td></tr><tr class="body"><td> </td></tr><tr class="footer"><td class="footer"></td></tr></table><table class="content" cellspacing="0" cellpadding="0"><tr><td colspan=3 class="descriptiontext"> Detailed Information</td></tr><tr><td class="formlabel"><font size="2">客户号码:</font></td><td class="formbody"><font size="2"> [%Current Item:客户号码%] </font></td><td class="altvb"> </td></tr><tr><td class="formlabel"><font size="2">客户所属大区:</font></td><td class="formbody"><font size="2"> [%Current Item:客户所属大区%] </font></td><td class="altvb"> </td></tr><tr><td class="formlabel"><font size="2">Old FIC Code:</font></td><td class="formbody"><font size="2">[%Current Item:Old FIC code%]</font></td><td class="altvb"> </td></tr><tr><td class="formlabel"><font size="2">Update FIC Code:</font></td><td class="formbody"><font size="2"> [%Current Item:Update FIC code%]</font></td><td class="altvb"> </td></tr><tr><td class="formlabel"><font size="2">是否為II類分銷商?</font></td><td class="formbody"><font size="2">[%Current Item:请问是否為II類分銷商?%]</font></td><td class="altvb"></td></tr><tr><td class="formlabel"><font size="2">更新理由:</font></td><td class="formbody"><font size="2"> [%Current Item:更新的理由%]</font></td><td class="altvb"> </td></tr><tr><td colspan=3 class="descriptiontext"> Last Modified [%Current Item:Modified%]</td></tr></table><BR><P class="title"><font size="2">To complete this task:<BR>1. Review <A HREF="[%Task Process:Web URL%]/[%Task Process:Item URL%]">[%Task Process:Item Title%]</A>. <BR>2. Perform the specific activities required for this task.<BR>3. Use the <B>Open this task</B> button to mark the task as completed. (If you cannot update this task, you might not have access to it.)<BR>4. View the <A HREF="[%Workflow Context:Workflow Status URL%]">status</A> of this workflow.</FONT></P></BODY></HTML>
11. Start Approval Process 可以有多个任务分配者,但是 Collect data from a user只能设置一个任务接收人;
12. 工作流任务的权限可以在Advanced Settings中的PermissionSet进行设置,是继承task列表的权限,还是只给任务分配者修改的权限,参考此页面;
另外,如果一个用户或者一个用户组不在工作流任务中,但又想让他进行审批,则可以将其加入到TaskProcessOwner中去,这样,他就可以进行审批,类似于站点管理员可以对所有task进行审批;
13. 每个站点SharePoint Designer Workflows都放在一个Workflows列表中,权限继承自站点,因此如果想使用此工作流,则必须在Workflows列表中有读取的权限,否则连任务模板(.xsn)都不能访问,会出现以下错误:
a form template file cannot be accessed. you may not have the required permissions to open the file
14.