3

I created a workflow to calculate the correct version of a document, taking into account that the documents we are putting onto SharePoint already have a version number before transfer to SharePoint. The workflow starts when a document is edited and Approval status = Approved (this will be true after an approval workflow runs that starts when a new major version is published.)

If this condition is met, the workflow calculated imported version + version and outputs to a variable calc3.

Then the workflow sets the variable "actual_version" to the value of calc3.

This sort of works, but when the workflow runs it creates a new draft version of the document, the calculated actual_version is associated with the draft version, not the published major version as I need it to be.

Is there anyway to stop the workflow from creating a new draft version?

Thanks

0

Not any that I know of using SharePoint Designer Workflow.. But you can use Event Receiver and on ItemUpdating check exact same conditions which you did in Workflow and set calc3 field to the new version!

Have a look at:
Creating a simple Event Receiver in SharePoint 2013

Let me know if you have any issues

  • 1
    Thanks for your suggestion @arsalan but I've never used visual studio and after looking into it decided it was a bit beyond me at the moment! I did get this working though... I calculated the next major version using mod function (to get remainder then adding the difference from 1 to the current version) and did it before the approval is sent out so that an extra draft version is created before publishing the major version. – user19482 Oct 2 '13 at 13:06
  • Or you can create your own Custom Workflow Activity as mentioned here.. Either way you will need to code the solution! – Arsalan Adam Khatri Oct 2 '13 at 13:29
0

Basically, workflows and the built-in Sharepoint Draft/Published feature don't play together. As you have discovered, as soon as you set an item to "Published" and the workflow responds by updating the item, the system considers that an edit and puts the item back to "Draft"...

Ideally workflows should have the capability to update items with the option of not triggering an "item change" event on the item, but that's not available.

The simplest soution is to abandon the built-in Draft feature and roll your own. Set up a choice column with the Draft/Published statuses (you can have add other values in there as well of course) and use view filters to hide draft items from normal site users.

It's not as secure as the built-in feature unless you also start tweaking the per-item permissions, because a knowledgeable user can create their own view that shows all items, but for a typical Intranet situation it's normally good enough.

0

If you can accept a jump in revision numbers you could add one to you calculation and have the workflow publish a new major version. This would mean a document with an initial version of 17 would be bumped to version 19 the first time a user adds a new major version and the workflow has run.

It's hardly the most elegant solution, but it might be it's not really an issue in your organisation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.