Question

Photo of Doug Curlee

0

Populate Address Field Type in a Workflow

We are building a Workflow to handle Connection Card Entry.  I have various fields on the form (First, Last, Phone, Email, etc.) including Address.  If we are keying a Connection Card for someone who is already in the system, I want to display the Address information.  The Address field in the workflow is an Address Field Type.  I can't figure out how to write the existing Person's home address into this field.

I've tried it using different text fields (Address, City, State, Zip) instead of the Address field type and I can get the address to display that way using:   

{{ Workflow | Attribute:'Person-SubmittingCard','Object' | Address:'Home', '[[Street1]]' }} 


What's the syntax to display an existing home address into an Address Field Type?

Thanks in advance.



  • Photo of Brian Davis

    0

    The address field type wants a Location.Guid as a value, so we've used something like this:

    {% assign Person = Workflow | Attribute:'Person','Object' %}

    {% if Person.PrimaryFamilyId and Person.PrimaryFamilyId != empty %} 

        {{ Person.PrimaryFamily.GroupLocations | Where:'GroupLocationTypeValueId', '19' | Select:'Location' | Select:'Guid' | First }}

    {% else %}

        {% assign groupMembers = Person | Groups: "10",'All' %}

        {{ groupMembers[0].Group.GroupLocations | Where:'GroupLocationTypeValueId', '19' | Select:'Location' | Select:'Guid' | First }}

    {% endif %}

    This essentially gets the Guid of the Person's Primary Family Home Location. If they don't have Primary Family it just uses the first family we find. More customization could be done to ensure that the address is the mailing or physical address, but this should work in most cases.

    You may need to replace '19' with the Defined Value Id associated with the 'Home' Value for the 'Location Type' Defined Type. You can find this under General Settings > Defined Types > Location Type > Home.

    home.png

  • Photo of Michael Allen

    1

    That field is looking for the guid of a location. 

    Getting that value for a person is a bit tricky because people don't have addresses in rock, groups (famlies) do. Also, a person could be in multiple families and therefore have multiple addresses.


    We use this lava in our connect card workflow to set the value of an address attribute to the first home address of the person's primary family.

    {{ Workflow | Attribute:'Person-SubmittingCard','Object' | Property:'PrimaryFamily.GroupLocations' | Where:'GroupLocationTypeValueId',19 | First | Property:'Location.Guid' }}


    This page will show you what type of data each type of attribute is expecting.

  • Photo of Nick Airdo

    1

    Michael, Brian, Thanks for showing Doug how to jump through those small hoops to get that data!  Doug, we feel that pain and help is on the way. Starting with v13, we've adding a new '[[Guid]]' option to the "Address" Lava filter to allow for easier retrieval of the underlying location's Guid. That should simplify things in the case you're describing.

    {{ CurrentPerson | Address:'Home','[[Guid]]' }}
    • Brian Davis

      Awesome! Thanks Nick for working with the team there to implement solutions like this that make everything a little easier. Looking forward to all the great stuff in v13!

      Notice Sent
      Yes
      Digest Sent
      Yes
  • Photo of Jim Michael

    1

    Just adding for future readers... as of v12 the "Enable Person Entry" option on a workflow Form action allows entering/displaying of a person's address (among many other properties), as well as optionally entering their spouse and adding them to the same family. This makes the hoops you had to jump through (pre v12) for "connect card" type workflows dealing with addresses largely unnecessary these days.

  • Photo of Doug Curlee

    0

    Michael and Brian, thank you guys very much!  Both suggestions work like a champ.  Appreciate the help!


    Doug