Question

Photo of Jeremy Turgeon

0

Parent Cell Merge Field

I'm trying to build a check-in label that shows the child's parent cell phone number.  Is this possible?  I couldn't find it on any of the merge fields.

  • Photo of Arran France

    0

    Hey Jeremy,

    I never got around to do this (I didn't stick it in ToDoist) did you get this sorted or should I still take a look?

    • Jeremy Turgeon

      Hey Arran. I believe the Lava code necessary to pull this information simply isn't in Rock yet. Hopefully 4.0 will include it.

    • Arran France

      There's now a Lava filter in 4.0 that lets you access a person's parents, so you can leverage that using a little more lava to get the desired result.

    • Andrew Metz

      We're you able to do this? I know there's the Parent filter now in Lava. And I wrote some Lava that works elsewhere but not in a label merge field. Do Person Filters not work in Label merge fields?


      {% assign parents = Person | Parents %}{% for person in parents %}{{ person.FullName }} {% for PhoneNumber in person.PhoneNumbers %} {% if PhoneNumber.IsMessagingEnabled == 'true' %} {{ PhoneNumber.NumberFormatted }} {% endif %}{% endfor %}{% endfor %}

  • Photo of Bob Rufenacht

    0

    I wrote the following for a label merge field and it is tested (we don't go live on Rock until April 23rd).  We have a paging system that is 6 numeric digits.  So we are paging parents by last 6 digits of phone number and putting that on their labels.  It uses Home phone if available, then Mobile phone if no Home phone. 

    Also, be careful - Can Check-In relationships can drive you a bit nuts.  We chose that if Family A is checking in Family B children to use the Family A number for paging.  That means that for a Child in Family B, Person.FamilyMember will be false.  I looped through the people being checked in to find one in the family to get the same numbers.  BUT there is a chance that Family A is checking in Family B children without any of their own children (e.g. Grandparents).  In that case the only option is to use Family B Home/Mobile numbers.

    And in all cases, there is a chance there are no numbers.  In that case we print "*_______" and let our team hand write a paging number as a last resort.  Hopefully we can get a phone number for future weeks.

    Here is the code but be careful.  In Label Merge fields no extra spaces or formatting are allowed.  So this shows neat spacing but you have to pull it all into one big run-on "sentence to work properly.

    {% assign found = False %}
    {% if Person.FamilyMember == True %}
       {% assign last6Phone = Person.Id | HeadOfHousehold | PhoneNumber:'Home' %}
       {% assign lastsize = last6Phone | Size %}
       {% if lastsize < 6 %}
         {% assign last6Phone = Person.Id | HeadOfHousehold | PhoneNumber:'Mobile' %}
         {% assign lastsize = last6Phone | Size %}
       {% endif %}
       {% if lastsize >= 6 %}
         {% assign last6Phone = last6Phone | Remove:'-' | Right:6 %}
         {% assign found = True %}
       {% endif %}
    {% else %}
       {% for person in People %}
         {% if person.FamilyMember == True %}
           {% assign last6Phone = person.Id | HeadOfHousehold | PhoneNumber:'Home' %}
           {% assign lastsize = last6Phone | Size %}
           {% if lastsize < 6 %}
             {% assign last6Phone = person.Id | HeadOfHousehold | PhoneNumber:'Mobile' %}
             {% assign lastsize = last6Phone | Size %}
           {% endif %}
           {% if lastsize >= 6 %}
             {% assign last6Phone = last6Phone | Remove:'-' | Right:6 %}
             {% assign found = True %}
           {% endif %}
           {% break %}
         {% endif %}
       {% endfor %}
       {% if found == False %}
         {% assign last6Phone = Person.Id | HeadOfHousehold | PhoneNumber:'Home' %}
         {% assign lastsize = last6Phone | Size %}
         {% if lastsize < 6 %}
           {% assign last6Phone = Person.Id | HeadOfHousehold | PhoneNumber:'Mobile' %}
           {% assign lastsize = last6Phone | Size %}
         {% endif %}
         {% if lastsize >= 6 %}
           {% assign last6Phone = last6Phone | Remove:'-' | Right:6 %}
           {% assign found = True %}
         {% endif %}
       {% endif %}
    {% endif %}
    {% if found == True %}{{last6Phone}}{% else %}*_____{% endif %}

    Hope it helps.