Building off this previous recipe to have a modal to enter a prayer comment from the new Prayer Card View block. In this recipe we want to build a button on the card to allow a Prayer Team member to enter an answer to a Prayer.

Why? Because a Prayer Request can only have one answer on it and access to the Answer field is usually only available on the Internal Rock side when managing the prayer requests. The challenge with that is anyone from the team enters a brand new prayer request but it is in fact just an answer to a previous prayer. Not a great experience and causes confusion for the team.

So how are we going to solve this? With a simple workflow entry page purpose built for the Prayer Card View block. If an answer already exists on the Prayer Request, then the page and card will display that answer not allowing anyone to change it. First in wins in regards to Prayer Request Answers unlike comments.

Step 1

Create the Workflow. Conveniently, I've attached the workflow to this recipe which you may import and modify for your church's needs. So let's start by going to Admin Tools - Power Tools - Import/Export Workflows and importing the workflow json file that you've just downloaded and extracted from the bottom of this recipe page. Look for the "Download File" button.

Step 2

Create a new page along side your existing Prayer Team and Possibly Prayer Comment page(s) to use as a place to hold your Workflow Entry.


The new page's Advanced Settings needs a page route which includes the parameter for the prayer request Id as well as a Context Parameter Name in order for the Notes Entry block to pick up on.


Page Route:

Step 3

Add a Workflow Entry block to the new Prayer Answer page. Ensure that the default Workflow set in the block settings is set to the newly imported Answered Prayer workflow.



Step 4

Add this code to the Advanced Settings of the newly added Workflow Entry block Pre-HTML field to check for a previously entered Answer to the selected Prayer Request and display it, otherwise, show the WEF.


{% capture prayerid %}{{ 'Global' | Page:'Path' | Remove:'/prayer-answer/' }}{% endcapture %}
{% comment %}{{ prayerid }}{% endcomment %}

{% prayerrequest where:'Id == {{ prayerid }}' %}
    {% for prayerrequest in prayerrequestItems %}
        {% assign pa = prayerrequest | Property:'Answer' %}
        {% assign requestor = prayerrequest.FirstName | Append:' ' | Append:prayerrequest.LastName %}
        {% if pa and pa != '' or pa != empty %}
            <h4>Current Answer</h4>
                <p class="alert alert-success"><b>{{ prayerrequest | Property:'Answer' }}</b></p>
            <style>div #ctl23_ctl01_ctl06_pnlWorkflowUserForm { display: none; }</style>
        {% else %}        
            <p class="card-text mb-2 mt-3">
                <i class="fa fa-quote-left mr-2"></i><span class="p-2 text-semibold leading-relaxed">{{ prayerrequest.Text }}</span><i class="fa fa-quote-right ml-2"></i>
            <h4>Add Answer to Prayer for {{ requestor }}:</h4>
        {% endif %}
    {% endfor %}
{% endprayerrequest %}

Step 5

Modify the Prayer Card View Display Lava Template to include a new button in the prayer request for loop to go to the new Answer Prayer page for the workflow. Here is an example that you may modify for your needs that I put into the card-footer div:

{% if item.Answer and item.Answer != empty %}
        <span class="d-inline bg-success rounded-sm p-2 mr-3 text-white"><i class="fa fa-bolt"></i> Answered</span>
{% else %}        
        <a href="{{ 'Global' | Attribute:'PublicApplicationRoot' }}prayer-answer/{{ prayerId }}" type="button" class="btn btn-primary btn-sm mr-3" target="_blank"><i class="fa fa-bolt"></i> Answer</a>  
{% endif %}

If a prayer Answer exists it'll disable the link to the workflow entry, change the look of the button to green indicating that an answer exists, and the card will show the answer below the request.



I'm including all of the code and lava templates in the zip of this recipe for copy/paste and modification purposes.