Developing workflows in vs: Part 5-code your workflow

Source: Internet
Author: User
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 shocould watch out:

Pitfall: re-using non-serializable SharePoint objects after rehydration
Other 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

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.