Description

When we migrated to Rock from Fellowship One a few years ago, we quickly realized it would be very helpful in certain situations to know how long ago a person record was created. This recipe simply adds the created and last modified dates to the bio section of a person's profile.

Bonus: We also had some requests to be able to see the last date that a person's home address was modified, so instructions for adding that are also included.

How-To

Person Created/Modified Dates

Person created/modified date screenshot
  1. Go to a person record and edit the Block Properties of the Person Bio block
  2. Add this code to the Custom Content field:
    {%- assign person = Context.Person -%}
    {%- if person -%}
        <div style="font-size:75%;cursor:default">
        {%- if person.CreatedDateTime != null -%}
            {%- assign creatorAliasId = person.CreatedByPersonAliasId -%}
            {%- if creatorAliasId != empty -%}
                {%- assign creator = creatorAliasId | PersonByAliasId -%}
                {%- capture title -%}
                    data-toggle="tooltip" data-original-title="Created{% if creator != null %} by {{ creator.NickName }} {{ creator.LastName }}{% endif %} on {{ person.CreatedDateTime | Date:'MMMM d, yyyy a\t h:mm:ss tt' }}"
                {%- endcapture -%}
            {%- endif -%}
            <span style="opacity:0.4" {{- title }}>Person Record Created: {{ person.CreatedDateTime | Date:'M/d/yyyy' | Default:'Unknown' }}</span>
        {%- endif -%}
        {%- assign title = '' -%}
        {%- if person.ModifiedDateTime != null and person.ModifiedDateTime != person.CreatedDateTime -%}
            {%- assign editorAliasId = person.ModifiedByPersonAliasId -%}
            {%- if editorAliasId != empty -%}
                {%- assign editor = editorAliasId | PersonByAliasId -%}
            {%- endif -%}
            {%- capture title -%}
                data-toggle="tooltip" data-original-title="Last modified{% if editor != null %} by {{ editor.NickName }} {{ editor.LastName }}{% endif %} on {{ person.ModifiedDateTime | Date:'MMMM d, yyyy a\t h:mm:ss tt' }}"
            {%- endcapture -%}
            <span style="opacity:0.4">{% if person.CreatedDateTime != null %}|{% else %}Person Record{% endif %}</span>
            <span style="opacity:0.4" {{- title }}>Modified: {{ person.ModifiedDateTime | Date:'M/d/yyyy' }}</span>
        {%- endif -%}
        </div>
    {%- endif -%}
  3. Save the block properties and you're done!

Home Address Modified Date

Home address last modified date screenshot
  1. Go to a person record and edit the Block Properties of the Family Members block
  2. Add this code to the Group Footer Lava field:
    <div class="clearfix ">
    {%- assign homeAddresses = Group.GroupLocations | Where:'GroupLocationTypeValueId','19' -%}
    {%- for homeAddr in homeAddresses -%}
        {%- if locModifiedDate == null or homeAddr.ModifiedDateTime > locModifiedDate -%} 
            {%- assign locModifiedDate = homeAddr.ModifiedDateTime -%}
            {%- assign locEditorAliasId = homeAddr.ModifiedByPersonAliasId -%}
        {%- endif -%}
    {%- endfor -%}
    {%- if locModifiedDate -%}
        {%- if locEditorAliasId and locEditorAliasId != empty -%}
            {%- assign locEditor = locEditorAliasId | PersonByAliasId -%}
        {%- endif -%}
        {%- capture locTitle -%}
            data-toggle="tooltip" data-original-title="Modified{% if locEditor != null %} by {{ locEditor.NickName }} {{ locEditor.LastName }}{% endif %} on {{ locModifiedDate | Date:'MMMM d, yyyy a\t h:mm:ss tt' }}"
        {%- endcapture -%}
        <small class="pull-right" style="cursor:default;font-size:80%;opacity:0.4" {{ locTitle }}>Last Home Address Update: {{ locModifiedDate | Date:'M/d/yyyy' }}</small>
    {%- endif -%}
    </div>
  3. Save the block properties and you're done!

Follow Up

Please don't hesitate to leave a comment or hit me up on Rock Chat (@JeffRichmond) if you have questions or find any issues with this recipe.


Change Log

  • 2022-03-25 - Initial version
  • 2022-04-04 - Added home address modified date