Approval workflow


  • 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.


    2009年9月24日 8:59


  • You 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.
    2009年9月24日 12:32
  • I 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?
    2009年9月24日 12:44
  • I 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?
    2009年9月24日 13:58
  • do you need a workflow to send an email?
    you can write an Event Receiver - OnItemUpdated which will send an email.

    bg Andrej
    2009年9月24日 14:32
  • 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.
    2009年9月24日 15:06
  • What Service Pack are you using and where do you have your send email function?
    2009年9月24日 15:33
  • 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 :)
    2009年9月25日 11:00
  • 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?
    2009年9月28日 7:01

  • SP2 may fix this problem. Can you try? But be aware of the 'license expirary problem' and install post-sp2 fix.
    2009年9月28日 17:46
  • I 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)
    2009年9月30日 10:20
  • Hi,

    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.

    2012年2月24日 5:26