I've recently started using a feature of Rock that I haven't seen get much attention, launching a workflow from a Grid. (More about that here)

While the lava isn't too difficult to get the person, I kept going back to workflows I had written to grab it, after all, no need to write it again. This has worked for me but not every grid is the same and might need different lava, so I decided to write a bit of lava that would handle most cases and put it into a workflow template. Whoa, wait, what, a template? Let me explain.

I created a workflow that has only one action, this action will get the person from the grid and populate the workflow attribute. Any time I need to create a workflow for a grid I simply copy the workflow to create my new one, adding whatever I need to do below the first action.

If you have ever needed to update a person attribute or other value that you can't access via the bulk update tool, then running a workflow from a grid is a serious time saver.

Now for the cool part. Above I mentioned that every grid could be different. e.g., if you are on a group, then the grid passes a group member, and you need specific lava to get the persons alias Guid, but if you are on a person report, dataview, or a tag list that contains people, what is passed to the workflow is different. The below lava will get a person on most types of grids(Group, Tag, Dataview, Report) and set the person attribute.

Here is the lava

{% assign groupMember = Entity.Person.Id | PersonById | Property:'PrimaryAlias' | Property:'Guid' %}
{% assign person = Entity.Id | PersonById | Property:'PrimaryAlias' | Property:'Guid' %}
{%- if groupMember != '' and groupMember != null -%}
    {{- groupMember -}}
{%- elseif person != '' and person != null -%}
    {{- person -}}
{%- endif -%}

I have also included the Workflow "Template" if you wish to use it. I left a debug action in it(remove the If statement if you want to run that action and look at what is being sent from a grid