none
SharePoint Designer 2010 Custom Workflow - Publishing a major version

    Question

  • Hello everybody,

    I have following problem:

    At the moment I am trying to design an Approval Workflow. Files get uploaded to a library, the workflow gets triggered automatically and the Approval-Process starts. So far, so good. Now I want to implement the functionality that, in case the document gets approved, SharePoint automatically publishes a major version (1.0) of the document, so it gets visible for everyone (and not only for users with Contributor-rights). My first thought was to make adjustments at "When a Task completes" at the Approval-Task, but unfortunately I haven't found a function to create a major version in the Designer yet. Is it possible that I overlooked it? If not, is there a workaround for that?

    It would be really nice if someone could help me on this issue.

    Many thanks in advance.

     

    Best regards

    Tobias


    Wednesday, December 07, 2011 9:49 AM

Answers

  • Hi SharePoint_Tobi,

    There is no such an activity to publish documents in SharePoint Designer. If you use OOB approval workflow or any globally reusable workflow inherited from it can be set to start to approve publishing a major version of an item, then after the workflow is approved, it will be publish as major version, otherwise, it will not be published. But if you enabled it to start to publish a major version, it will not be allowed to start automatically when a new item is created.

    So if you don’t want to use this feature, you can need to create a VS approval workflow or create a custom SharePoint Designer activity. Or if you want to use this feature, programming is also needed to create a custom activity to start the workflow automatically.
    Please refer to this blog about how to create a custom approval workflow in Visual Studio.
    http://elczara.wordpress.com/2010/07/25/basic-custom-sharepoint-2010-approval-workflow-%E2%80%93-part-1/

    Best regards.


    Emir Liu

    TechNet Community Support

    Thursday, December 08, 2011 8:37 AM
  • Hi Emir,

    I found a workaround:

    - I enabled "Content Approval" in the library
    - I disabled "Require Check out" in the library
    - Via SharePoint Designer I added a step at "When the Tast Process Completes": "Set content approval of item that the task process is running on to Approved (run as the workflow author)".

    The workflow works fine now: If I upload a document the workflow starts and the Approval Status is "Pending". Now only Contributors can see the Pending documents. When the workflow is done, the Approval Status changes to "Approved" and then everyone can see the document (even a major version gets created!!). That's exactly what I wanted.

    But now I have a strange bug/problem:

    If I set the workflow to "Start automatically, when Element is created" and I upload the first document everything is fine.
    BUT if I upload a second document (after the workflow of the first document is finished) the workflow doesn't start anymore and the status of the workflow gets automatically set to "Completed" (Approval Status stays on "Pending"). Do you understand what I mean? By the way: If I set the start option to "Allow manual starting of the workflow" I don't have this problem. This is really strange.. Can you help me with that? Do you think I should open a new thread for this issue?

    Thanks in advance.

    Best regards.


    Thursday, December 15, 2011 3:07 PM

All replies

  • Hi SharePoint_Tobi,

    There is no such an activity to publish documents in SharePoint Designer. If you use OOB approval workflow or any globally reusable workflow inherited from it can be set to start to approve publishing a major version of an item, then after the workflow is approved, it will be publish as major version, otherwise, it will not be published. But if you enabled it to start to publish a major version, it will not be allowed to start automatically when a new item is created.

    So if you don’t want to use this feature, you can need to create a VS approval workflow or create a custom SharePoint Designer activity. Or if you want to use this feature, programming is also needed to create a custom activity to start the workflow automatically.
    Please refer to this blog about how to create a custom approval workflow in Visual Studio.
    http://elczara.wordpress.com/2010/07/25/basic-custom-sharepoint-2010-approval-workflow-%E2%80%93-part-1/

    Best regards.


    Emir Liu

    TechNet Community Support

    Thursday, December 08, 2011 8:37 AM
  • Hi Emir,

    thanks a lot for your response!

    I think the solution you describe in the first paragraph is pretty nice. But I don't understand why the workflow has to be
    started manually if this function is enabled, that doesn't make sense to me. Do you know a solution to get this workflow started automatically, that is not too complicated (without Visual Studio)?
    This would be perfect!

    Thanks in advance.

    Best regards.



    Thursday, December 15, 2011 10:10 AM
  • Hi SharePoint_Tobi,

    This is because that when you set start the workflow to approve publishing a major version, the start workflow when a new item is created/changed option will be disable at the same time. So we can't set the workflow start both of these options automatically.

    Best regards.


    Emir Liu

    TechNet Community Support

    Thursday, December 15, 2011 11:49 AM
  • Hi Emir,

    I found a workaround:

    - I enabled "Content Approval" in the library
    - I disabled "Require Check out" in the library
    - Via SharePoint Designer I added a step at "When the Tast Process Completes": "Set content approval of item that the task process is running on to Approved (run as the workflow author)".

    The workflow works fine now: If I upload a document the workflow starts and the Approval Status is "Pending". Now only Contributors can see the Pending documents. When the workflow is done, the Approval Status changes to "Approved" and then everyone can see the document (even a major version gets created!!). That's exactly what I wanted.

    But now I have a strange bug/problem:

    If I set the workflow to "Start automatically, when Element is created" and I upload the first document everything is fine.
    BUT if I upload a second document (after the workflow of the first document is finished) the workflow doesn't start anymore and the status of the workflow gets automatically set to "Completed" (Approval Status stays on "Pending"). Do you understand what I mean? By the way: If I set the start option to "Allow manual starting of the workflow" I don't have this problem. This is really strange.. Can you help me with that? Do you think I should open a new thread for this issue?

    Thanks in advance.

    Best regards.


    Thursday, December 15, 2011 3:07 PM
  • Hi SharePoint_Tobi,

    Yes, could you please give a new thread. Since this thread will be closed due to you had already found the workaround.

    Thanks & Regards.


    Emir Liu

    TechNet Community Support

    Friday, December 16, 2011 2:53 AM