none
Approval workflow

    Question

  • 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 8:59 AM

All replies

  • 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.
    Thursday, September 24, 2009 12:32 PM
  • 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?
    Thursday, September 24, 2009 12:44 PM
  • 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?
    Thursday, September 24, 2009 1:58 PM
  • do you need a workflow to send an email?
    you can write an Event Receiver - OnItemUpdated which will send an email.

    bg Andrej
    Thursday, September 24, 2009 2:32 PM
  • 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.
    Thursday, September 24, 2009 3:06 PM
  • What Service Pack are you using and where do you have your send email function?
    Thursday, September 24, 2009 3:33 PM
  • 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 :)
    Friday, September 25, 2009 11:00 AM
  • 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?
    Monday, September 28, 2009 7:01 AM

  • SP2 may fix this problem. Can you try? But be aware of the 'license expirary problem' and install post-sp2 fix.

    http://blogs.msdn.com/sharepoint/archive/2009/04/28/announcing-service-pack-2-for-office-sharepoint-server-2007-and-windows-sharepoint-services-3-0.aspx
    Monday, September 28, 2009 5:46 PM
  • 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)
    Wednesday, September 30, 2009 10:20 AM
  • 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.

    Friday, February 24, 2012 5:26 AM