惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
Cisco Talos Blog
Cisco Talos Blog
C
Check Point Blog
博客园_首页
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Martin Fowler
Martin Fowler
Recorded Future
Recorded Future
S
Security @ Cisco Blogs
L
LINUX DO - 最新话题
博客园 - 司徒正美
P
Privacy International News Feed
G
Google Developers Blog
I
Intezer
Hacker News - Newest:
Hacker News - Newest: "LLM"
博客园 - 聂微东
The GitHub Blog
The GitHub Blog
C
Cybersecurity and Infrastructure Security Agency CISA
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Scott Helme
Scott Helme
K
Kaspersky official blog
I
InfoQ
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
Webroot Blog
Webroot Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
大猫的无限游戏
大猫的无限游戏
D
Docker
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
Microsoft Azure Blog
Microsoft Azure Blog
Spread Privacy
Spread Privacy
量子位
H
Hacker News: Front Page
Simon Willison's Weblog
Simon Willison's Weblog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
SecWiki News
SecWiki News
S
Security Affairs
Latest news
Latest news
人人都是产品经理
人人都是产品经理
C
CERT Recently Published Vulnerability Notes
S
Security Archives - TechRepublic
V
Visual Studio Blog
T
Troy Hunt's Blog
S
Secure Thoughts
F
Fortinet All Blogs
V
V2EX
The Register - Security
The Register - Security
J
Java Code Geeks
MongoDB | Blog
MongoDB | Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO

博客园 - jianyi

SpringBoot - open-in-view 机制分析 w3wp CPU 100%问题解决 ShrePoint 迁移域控 SharePoint online 获取文件版本记录 SharePonit online 列表表单定制 VS2015 ionic 开发环境配置纪要 TFS online build change web.config SharePoint 2016 - 安装QuickFlow2013 EF Migrations error: No connection string named 'MpDb' could be found in the application config file. TFS online 自动部署配置 SharePoint Permission Extension SharePoint暂时禁用事件触发 视图xsl定制之嵌入服务器控件 自定义View字段表头 自定义母版页之列表过滤菜单位置issue fix ListDefinition Tips QuickFlow UI 控件之 NamedFormAttachment SharePoint 2010 GridView/SPGridView完全应用系统样式 DLL嵌入exe中
QuickFlow-如何通过QFD and ExecuteCode获取其他列表数据
jianyi · 2013-05-14 · via 博客园 - jianyi

场景:有个配置列表用来配置每步的审批人,配置列表字段如下:

Title: 工作流名称

Level1Approver:第一步审批人

Level2Approver:第二步审批人

操作步骤:

请先了解ExecuteCode活动:http://www.cnblogs.com/jianyi0115/archive/2011/04/17/2018872.html

新建工作流,加两个string类型工作流变量:level1Approverlevel2Approver

拖一个ExecuteCode活动,拖两个Task活动,task活动的User属性分别绑定到level1Approverlevel2Approver

画线连接Start->ExecuteCode-Task1->Task2.

双击ExecuteCode,写脚本如下:

QueryField titleField = new QueryField("Title");

SPList cfgList = this.Web.Lists["审批人配置"]; //获取列表

var cfgItem = ListQuery.From(cfgList).Where(titleField=="名片申请").GetItems()[0]; //获取到配置项

//获取字段值

SPFieldUserValue user1Value = cfgItem .Fields.GetField("Level1Approver").GetFieldValue(cfgItem["Level1Approver"].ToString()) as SPFieldUserValue;

var level1User = user1Value.User.LoginName;

this.Log("getLevel1Approver:" + level1User); //写调试日志

this.SetVariable("level1Approver", level1User); //设置变量

//获取字段值

SPFieldUserValue user2Value = cfgItem .Fields.GetField("Level2Approver").GetFieldValue(cfgItem["Level2Approver"].ToString()) as SPFieldUserValue;

var level2User = user2Value.User.LoginName;

this.Log("getLevel2Approver:" + level2User);

this.SetVariable("level2Approver", level2User);

工作流:

添加变量:

Code

 备注:

1) 若有能力在自定义表单中写代码,那么还是尽量把代码写的表单提交前,通过工作流变量传入需要的数据。

因为工作流内部执行代码出错,将造成整个工作流失败,并且无法挽回。只能重启流程。