<p>After doing some digging around I found the <code>getDraftsByEntryId(entryId, locale)</code> method of the <code>craft.entryRevisions</code> service that might help.</p>

<p>The following should return the first draft of an entry. Note: there is a second argument for 'locale', which defaults to current locale if none provided. Also not sure whether 'first' or 'last' would be considered the most recent draft.</p>

<pre><code>{% set drafts = craft.entryRevisions.getDraftsByEntryId(entry.id) %}
{% if drafts|length %}
    {% set draft = drafts[0] %}
    {{ draft.title }}
    ...
{% endif %}
</code></pre>

<p>You will need to load the entry manually (i.e. through a custom route of some kind) as the draft's entry is likely to be 'disabled' (although not necessarily) and thus not load through the entry's default url. Something like '/mysection/edit/slug' perhaps (where 'slug' is a custom route token).</p>

<pre><code>{% set entry = craft.entries({
    section: 'mysection',
    slug: slug
    status: null
}).first() %}
</code></pre>

CC BY-SA 3.0
2015-01-23T15:16:37.867Z
Works like a charm! Not sure how I missed that method, but thanks for the help.
etx
CC BY-SA 3.0
2015-01-22T19:14:42.987Z
2015-01-22T20:18:15.207Z
2015-01-22T20:18:15.207Z
Douglas McDonald
<p>I've been searching for a method to load in an existing entries drafts. Here is what I am trying to implement.</p>

<p>User can add or edit an entry from the front end of my craft site. They cannot publish.
Admin can see new drafts and publish them.</p>

<p>I see how to submit a draft update via the front end using the entryRevisions/saveDraft method. But how can I load in the current entries draft information into a form on the front end for a user to edit? Hopefully I missed this, or is it undocumented. </p>

CC BY-SA 3.0
2015-01-22T16:33:39.480Z
possible duplicate of [Does Craft Have Publishing Workflow?](http://craftcms.stackexchange.com/questions/2533/does-craft-have-publishing-workflow)
carlcs
CC BY-SA 3.0
2015-01-22T16:47:47.933Z
Not a duplicate. That post has absolutely no reference to the draft system or the method I'm looking for.
etx
CC BY-SA 3.0
2015-01-22T17:47:20.857Z
Yep right, thought you meant save without publish. Sorry!
carlcs
<admin><frontend>
Loading an existing entries drafts in template/frontend
# Loading an existing entries drafts in template/frontend

(Asked by: username_0 on 2015-01-22)

I've been searching for a method to load in an existing entries drafts. Here is what I am trying to implement.

User can add or edit an entry from the front end of my craft site. They cannot publish.
Admin can see new drafts and publish them.

I see how to submit a draft update via the front end using the entryRevisions/saveDraft method. But how can I load in the current entries draft information into a form on the front end for a user to edit? Hopefully I missed this, or is it undocumented.

**Tags:** admin, frontend
> **Comments:**
> **username_1**: possible duplicate of [Does Craft Have Publishing Workflow?](http://craftcms.stackexchange.com/questions/2533/does-craft-have-publishing-workflow)  
> **username_0**: Not a duplicate. That post has absolutely no reference to the draft system or the method I'm looking for.  
> **username_1**: Yep right, thought you meant save without publish. Sorry!  

---

## 1 answers

### Answer by username_2 on 2015-01-22. Score: 5 | Accepted answer

After doing some digging around I found the getDraftsByEntryId(entryId, locale) method of the craft.entryRevisions service that might help.
The following should return the first draft of an entry. Note: there is a second argument for 'locale', which defaults to current locale if none provided. Also not sure whether 'first' or 'last' would be considered the most recent draft.
{% set drafts = craft.entryRevisions.getDraftsByEntryId(entry.id) %}
{% if drafts|length %}
    {% set draft = drafts[0] %}
    {{ draft.title }}
    ...
{% endif %}

You will need to load the entry manually (i.e. through a custom route of some kind) as the draft's entry is likely to be 'disabled' (although not necessarily) and thus not load through the entry's default url. Something like '/mysection/edit/slug' perhaps (where 'slug' is a custom route token).
{% set entry = craft.entries({
    section: 'mysection',
    slug: slug
    status: null
}).first() %}

> **Comments:**
> **username_0**: Works like a charm! Not sure how I missed that method, but thanks for the help.  

---

