Hi, all. I have such problem:
I need a workflow, which solves the following tasks:
Approval workflow (such as default in MOSS 2007) + a possibility to send email messages to participants of Approval workflow when document, on which approval workflow was started, is modified.
For such a distribution has written a workflow, which is triggered by changes in the document and the code is running check whether the approval process started. But bad luck, if the document library includes support check out \ check in, then we have the following troubles - SharePoint commits a change to the list item both in check out and check in. As a result we have two changes and my email-workflow starts twice. As a result, one that very moment, we obtain immediately two letters to change the document in mailbox.
How can I solve such problem?
May already exists a approval workflow, which makes this newsletter. Thanks in advance.
I should explain:
When I doing check out, first email workflow starts. And it's status is starting in workflow history list. workflow does not complete. Next when I doing check in, this first email forkflow completes in same moment. I think it's respond on document check in. Next we see such sing: second email forkflow starts in same moment when I do check in and first workflow completed.
What we have: both workflows completed when document is in check in status. That's why I can'n track such change. I do not know why SharePoint check two changes.
My workflow responds on item change.
Hope, I'll resolve this problem with your's help.
SP1, I use sendmail activity for my workflow to send mail. Who can explain, why does sharepoint start my workflow twice? When I do not use check in\check out it starts once a time. But I have to use check in\check out in my library, director said it :)
I have some ideas to solve the problem. I want to read history list off all completed workflows for current document. And if I allready founded email workflow wich was completed several seconds ago new email workflow does not start. But I can't find example code in MSDN. Can you help me?
I just founded such code:
SPWorkflowCollection WfEndCol = manager.GetItemWorkflows(ListItem);
foreach (SPWorkflow sWf in WfEndCol)
How can I access value of "Ended" filed in /_layouts/Workflow.aspx page?
SP2 may fix this problem. Can you try? But be aware of the 'license expirary problem' and install post-sp2 fix.
I have suggestion and its a workaround.
you don't start workflow automatically from document library.
- Instead handle document library ItemCheckedIn/ItemCheckedOut event.
- On these event you have all information about the current document causes event trigger.
- Start a workflow using code and pass all the required information about current document into workflow as a association data.
- Use association data to build email body from document information.
I hope this approach work for you. Please let me know about the same.