Thursday, September 24, 2009 8:59 AM
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.
Thursday, September 24, 2009 12:32 PMYou can check the status of the document to see if it is being checked-in or check-out and if it is being checked-out, stop the workflow.
Thursday, September 24, 2009 12:44 PMI used such way, but no rezults and I know why. It's happens becouse when workflow copmletes it's work, document is allready in checked-in status. And such rezult in both cases. May be there is another way?
Thursday, September 24, 2009 1:58 PMI don't quite understand here. I thought you said that two workflows are started, one during check-in and one during check-out, therefore two emails are sent. Is this not the case?
Thursday, September 24, 2009 2:32 PMdo you need a workflow to send an email?
you can write an Event Receiver - OnItemUpdated which will send an email.
Thursday, September 24, 2009 3:06 PMI 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.
Thursday, September 24, 2009 3:33 PMWhat Service Pack are you using and where do you have your send email function?
Friday, September 25, 2009 11:00 AMSP1, 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 :)
Monday, September 28, 2009 7:01 AMI 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?
Monday, September 28, 2009 5:46 PM
SP2 may fix this problem. Can you try? But be aware of the 'license expirary problem' and install post-sp2 fix.
Wednesday, September 30, 2009 10:20 AMI already installed SP2 but the problem still present. And in different time different ruzult. One time I have one message on my mail (SP starts one email-WF) other time I have two mails)
Friday, February 24, 2012 5:26 AM
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.