DocumentHelper.GetDocument ignoring workflow.

User Name asked on December 3, 2014 18:05

Hi there

This might be simple but, I'm using 'DocumentHelper.GetDocument' with workflow turned on (Kentico 7.0.82). It seems that GetDocument just grabs the latest saved version of the document and ignores that I've not actually published my changes yet. Setting the 'selectOnlyPublished' flag doesn't seem to make a difference.

Is DocumentHelper.GetDocument compatible with Workflow?

Thanks.

Recent Answers


Virgil Carroll answered on December 4, 2014 00:14

I am not aware of any limitations around that. Just to make sure, have you verified that the document you are accessing is actually set at the Edit or Approval step? What is the version number you are getting back? Is it a major version or a minor step?

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on December 4, 2014 04:36

Workflow and versioning are two different things. Granted, versioning needs workflow to properly work, but they are two different things.

If you review what the API comments state, "Returns current document version. If versioning is used, gets the current VersionHistory record, otherwise gets the record directly from the database." So in all actuality, it is doing what it should. You just have to perform additional checking:

  • to see if the document is in workflow
  • what step its in
  • if it is in workflow and in a non-published step, you'd have to go back and get the version where it was last published then.

Maybe I'm thinking too hard on this one, but it seems right. You might also check out the /CMSAPIExamples that are installed with your instance to see how they handle workflow and versioning via the API as well.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.