Recipe - Simple 'who created who' functionality
Skill level: Intermediate
Organization: Calvary Church (St. Peters, MO)
Requires Rock: 1.10.0
{# strip images & classes from the HTML but otherwise leave structure #}
Rock does a great job (through it's History tab) of helping you understand what's changed for a person's profile, including understanding who created that person.
However, what if you want to go backwards, and get a list of all the people that a particular person created? This question came up in Rocket.Chat recently. Here are options for SQL, Lava, and a Report with Lava. You can use these in various places within Rock (depending on how and where you want to expose this).
SQL
SELECT
[Id]
,[FirstName]
,[NickName]
,[MiddleName]
,[LastName]
,[CreatedByPersonAliasId]
FROM Person
WHERE [CreatedByPersonAliasId] = 'xxx' -- replace xxx with the PersonAliasId of the person you want to report on
Lava
{% person where:'CreatedByPersonAliasId == "xxx"' %} //- replace xxx with the PersonAliasId of the person you want to report on
{% for person in personItems %}
{{ person.FullName }} <br/>
{% endfor %}
{% endperson %}
Report column via Lava
This is even easier to do in a report. Here's what you need to do:
- Create a Data View for newly created persons
- Applies to: Person
- Filter: Created Date Time During Range (and then select the appropriate range. I chose 'Last 1 week').
- Create a report referencing the Data View you created
- Add appropriate columns to the report. I suggest starting with Person Name and Created Date Time columns
- Add the creator using Lava, using the following method
Screenshots
- /GetImage.ashx?guid=ddd27f6e-92c6-4ba5-a910-92133fd9fda4
- /GetImage.ashx?guid=7dc2396a-7f49-43cc-b488-7fde713f221c