Developing Workflows in VS: Part 5 - Code Your Workflow

Step 3: Code Your Workflow

With your data in place, write your workflow logic.  It’s pretty straightforward, but here are a couple pitfalls that you should watch out for:

Pitfall: Re-using non-serializable SharePoint objects after rehydration
Many non-workflow specific SharePoint objects, like SPListItem, are not serializable, so when the workflow dehydrates, these items become invalid.  So if you try to use them when the workflow wakes up, you will get an error.  To avoid this, refetch items if you’re using them after a workflow rehydrates. 

Pitfall: Forgetting to make custom classes serializable
When creating your own class in a workflow, don’t forget to add the “Serializable” attribute to the class.  If you don’t do this and declare a variable of that class in the workflow’s scope, the workflow will fail when it tries to go to sleep and serialize the class.  If you notice that the workflow “completes” when it isn’t supposed to, this may be the culprit.

Pitfall: Updating locked items
If a document is open or locked, updating the item will throw an exception.  If you need a workflow to write to a column on the item, you can try to:  a) Have the workflow poll for the lock and executing the update only when the lock is released, or b) use item.SystemUpdate() to “burn through” the lock.  Note that for option (b), the user who has the document open will blow away the workflow’s changes if he saves the document.

FAQ: How do I set a custom status for my workflow?
The SharePoint SetState activity does this.  See WSS SDK for details.

 

Next time: Deploy and Debug Your Workflow

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
98% after emitting CopyPlugin ERROR Failed to compile with 121 errors 下午1:57:47 error in ../workflows/module/workflow/module/workflowModal.vue?vue&type=style&index=0&id=1daa1fe1&lang=scss&scoped=true Syntax Error: <!--新增和导入 二合一弹窗--> ^ Can't find stylesheet to import. ╷ 2 │ @import "@dataspherestudio/shared/common/style/variables.scss"; │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ╵ stdin 2:9 root stylesheet in D:\gdongt\packages\workflows\module\workflow\module\workflowModal.vue (line 2, column 9) @ D:/gdongt/node_modules/vue-style-loader??ref--8-oneOf-1-0!D:/gdongt/node_modules/css-loader??ref--8-oneOf-1-1!D:/gdongt/node_modules/@vue/cli-service/node_modules/vue-loader/lib/loaders/stylePostLoader.js!D:/gdongt/node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-2!D:/gdongt/node_modules/cache-loader/dist/cjs.js??ref--0-0!D:/gdongt/node_modules/vue-loader/dist??vue-loader-options!../workflows/module/workflow/module/workflowModal.vue?vue&type=style&index=0&id=1daa1fe1&lang=scss&scoped=true 4:14-475 15:3-20:5 16:22-483 @ ../workflows/module/workflow/module/workflowModal.vue?vue&type=style&index=0&id=1daa1fe1&lang=scss&scoped=true @ ../workflows/module/workflow/module/workflowModal.vue @ ../workflows/module sync ([a-z|A-Z])+.vue$ @ ./node_modules/dynamic-modules.js @ ./src/dynamic-apps.js @ ./src/main.js @ multi (webpack)-dev-server/client?http://192.168.100.70:8080/sockjs-node (webpack)/hot/dev-server.js ./src/main.js error in ../dataService/module/dataManagement/apiIndex.vue?vue&type=style&index=0&id=4fda01e9&lang=scss&scoped=true
06-08

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值