HollyPony
HollyPony

Reputation: 847

Apostrophe Workflow: Find Draft / Live Documents

Exploring apostrophe-worflow, I wonder how to search draft or live version of my document using self.apos.myModule.find(...) with an option.

EDIT: My use case is task, so, there is no current locale, so, I suppose the default locale will be taken.

I know I need some change in current code but, I want to know how to detect a "weird" behaviour and I need to know how workflow works.

Beside this, this question is also extend to which locale is return for a .insert or .update function.

Any ideas ?

Upvotes: 0

Views: 133

Answers (1)

Tom Boutell
Tom Boutell

Reputation: 7572

You can use .find(...).workflowLocale('default') or .find(...).workflowLocale('default-draft'), for instance. Append -draft to any locale name to get the draft content instead, remove it to get the live content... etc.

The default of course is to fetch documents for the current locale.

Upvotes: 1

Related Questions