Purpose

We wanted a way to be able to print a phone number on the child's note label, which is used for our rosters at each area's check-in station. For this to be most useful for our ministry areas and families, we needed to be able to print the number that was used to search for the child at check-in. The idea being that if the person checking a child in uses a number not their own (in like a grandparent or aunt/uncle relationship using the parent's number), they'd come ask for it to be updated at our solution center where we could add an "Allow Check-in By" relationship.

Note: We only use phone numbers for check-in. If you allow name / phone number search, additional logic would be needed in the Lava shortcode to accommodate that.


Step 1 - Create Lava Shortcode

The phone number used at search time is not available in a merge field, however it is stored in SQL in the Attendance table. The shortcode is necessary since it uses SQL and RockEntity commands, which the check-in block types cannot run and don't natively allow enabling. The shortcode allows you to enable SQL and RockEntity commands for just that shortcode.

  1. Go to Rock Settings > CMS Configuration > Lava Shortcodes and add a new shortcode
  2. Set the following information:
    • Name: Check-In Phone Number
    • Tag Name: checkinphone
    • Description: Allows you to print the phone number used to check-in the child on the child's tag.
    • Active: checked
    • TagType: Inline
    • Documentation: I kept this simple, but whatever you put here is what shows when you expand it in the Lava Shortcode list.
    • LavaShortcodeDetails.png
  3. Configure the Shortcode Markup
    • The SQL query is selecting the first search value from the most recent attendance occurrence of the person being checked in. The SearchValue column is whatever is typed into the check-in station. The phonenumber Entity command is used to get the formatted phone number, since the phone number search allows for 7 and 10 digit number. The results | First command is necessary, because sometimes there could be the same phone number twice in the table.
{% sql %}
   SELECT TOP 1 a.SearchValue
  FROM Attendance as a
  WHERE a.PersonAliasId = {{ Person.Id }}
    ORDER BY a.CreatedDateTime DESC    
{% endsql %}    
{% assign firstResult = results | First %}    
{% phonenumber where:'Number $= {{ firstResult.SearchValue }}'%}
   {% assign topNum = phonenumberItems | First %}
   {{ topNum.NumberFormatted }}
{% endphonenumber %}

        Lava Markup.png

4. The only parameter necessary is the ID of the person being checked in. In this case,