The Goal:

Dynamic Fields in Registrations & Workflow Forms

Two Approaches:

Lava

{% group where:'ParentGroupId == 1234' securityenabled:'false' %}
  {% for group in groupItems %}
    {{ group.Id }}^{{ group.Name }}
    {% unless forloop.last %},{% endunless %}
  {% endfor %}
{% endgroup %}

Note:

  • Include securityenabled:'false' so the person submitting the form can access the group data.
  • Single & Multi-Select fields use a pattern of {{ Value }}^{{ Text to Display }}. In this case we'll use the Group Id as the value and the Group Name as the text to display.
  • We need commas between each element, but not the last, so we use the unless command to add those.

SQL

SELECT
  [Id] AS [Value]
  , [Name] AS [Text]
FROM
  [Group]
WHERE
  [ParentGroupId] = 1234

Note:

  • Put the raw SQL in the box (don't put it in a {% sql %} lava filter.
  • You will need to return a [Value] column and a [Text] column
  • Try this SQL somewhere else first. If it fails, Rock can error when you try to go back and fix it. It's a huge pain to fix (not that I'd know from experience...)

Bonus: More info about registration workflows: Rock Manual