Skip to content

Helpful Lava

Listing form pack drafts for a user

To show a user any form pack drafts they may have already started, you can use the following lava. You should replace YOUR_URL with a page route that has a FormPackEntry block, which will allow the user to continue editing.

{% formpackentry
    expression:'((PersonAlias.PersonId == {{ CurrentPerson.Id }}) || (FormPack.SharedByFamilies == true && PersonAlias.Person.PrimaryFamilyId == {{ CurrentPerson.PrimaryFamilyId }})) && Status == 1' sort:'ModifiedDateTime desc' %}
{% endformpackentry %}


{% if formpackentryItems != null %}

<div class="list-as-blocks clearfix">
    <ul>
        {% for entry in formpackentryItems %}
            <li class="task">
                <a href="/YOUR_URL?entryId={{entry.Id}}">
                    <h3>{{ entry.Name | Default:entry.FormPack.PublicName | Default:entry.FormPack.Name }}</h3>

                    <div class="progress">
                        <div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: {{ entry.Progress }}%;">
                        </div>
                        <span class="text">{{ entry.Progress }}% complete</span>
                    </div>

                    <span class="requested-by text-muted">Started {{ entry.CreatedDateTime |  HumanizeTimeSpan:'Now',1 }} ago</span>
                    <i class="fal fa-angle-right"></i>
                </a>
            </li>
    {% endfor %}
    </ul>
</div>

{% endif %}