7 Helper Workflow Starter Pack Shared by Leah Jennings, Northside Christian Church 2 years ago 10.0 Administration / Finance, General Intermediate The more we write workflows, the more we've realized the benefit of breaking specific tasks (like adding a group member with attributes or creating a person) out into other workflows instead of doing it all within the main workflow. Now, you may be thinking, "Aren't there actions that perform those tasks for you? Why put it into another workflow?" Great questions, and the answer is loops. It's easier to loop through a data set within Lava vs looping through multiple actions within an activity. This gives you a lot of flexibility when it comes to what actions need to be performed. So we started writing what we've dubbed "helper" workflows that perform a single task for us that we can activate within a loop in Lava.If you have any programming background, think of these workflows as functions or sub-routines. The purpose is a single task; these workflows would never be ran by themselves, but rather, always called from another, primary workflow.I've bundled in this recipe all the generic "helper" workflows we've written so far and documentation on how we use each of them. We have several niche helper workflows as well, but they don't make as much sense unless you see the entire process it's part of, so only the generic ones are included here! All of the example code is ran inside a Lava Run action.Set SMS Enabled on ProfileCreate Connection RequestCreate PersonAdd Step to PersonAdd Person to Group as Active (w/up to three member attributes)Send SMSSet SMS Enabled on Profile (Id:108 in example)We had a registration for a gathering where we wanted to be able to text the individual registrants closer to the time of the gathering. We used another workflow to loop through the registrants and activate this workflow to set their SMS flag to enabled.{% assign regid = Workflow | Attribute:'RegistrationId' %} // Integer type{% registration where:'Id == "{{ regid }}"' %} {% assign reg = registrationItems | First %} {% for registrant in reg.Registrants %} {% workflowactivate workflowtype:'108' Person:'{{ registrant.PersonAlias.Guid }}' %} Activated new workflow with the id of #{{ Workflow.Id }} and name of {{ Workflow.Name }}. {% endworkflowactivate %} {% endfor %}{% endregistration %} Create Connection Request (Id:93 in example)We have a place on campus where we invite anyone to come and be known, ask questions, and get connected to a next step. An that area we have iPads with what we call our Next Steps Form. Almost all of our next steps are funneled through connection requests, so the Next Steps Form has multiple check boxes that a staff person or volunteer can check that the person is interested in that specific thing. Because we don't know which boxes will be checked, we have to use a loop to go through each one that's checked and create the corresponding connection request. {% assign Christ = Workflow | Attribute:'fe-christ','RawValue' %} // Multi-Select type of Connection Opp. guids{% assign isFirstTime = Workflow | Attribute:'fe-firsttime' %} // Boolean type{% assign requestor = Workflow | Attribute:'wf-person','RawValue' %} // Person type{% assign otherComment = Worfklow | Attribute:'fe-otherinfo' %} // Text type{% capture connRequestComment %}{{ Workflow | Attribute:'wf-person' }} visited the Living Room during the {{ Workflow | Attribute:'fe-service' }} service and spoke with host {{ Workflow | Attribute:'fe-livingroomhost' }}. {% if isFirstTime != '' %}They also acknowledged as a first-time guest with us!{% endif %} They are interested in these next steps: {% if Christ != '' %}{{ Workflow | Attribute:'fe-christ' }}{% endif %}{% if community != '' %} {{ Workflow | Attribute:'fe-community' }}{% endif %}{% if calling != '' %} {{ Workflow | Attribute:'fe-calling' }}.{% endif %}<br><br>Comment from {{ Workflow | Attribute:'fe-livingroomhost' }}: {{ Workflow | Attribute:'fe-livingroomcomment' }}<br><br>{% if otherComment != '' %}Comment for "Other" next step: {{ Worfklow | Attribute:'fe-otherinfo' }}{% endif %}{% endcapture %}{% if Christ != '' %} {% assign ChOpps = Christ | Split:',' %} {% for opp in ChOpps %} {% workflowactivate workflowtype:'93' Requestor:'{{ requestor }}' Comment:'{{ connRequestComment }}' ConnectionOpportunity:'{{ opp }}' %} Activated new workflow with the id of #{{ Workflow.Id }}. {% endworkflowactivate %} {% endfor %}{% endif %}Create Person (Id:185 in example)We setup a way for people to have what we called an "at-home baptism", where they don't have to be baptized on our campus, all they need is a body of water where they are. There was a form they could fill out letting us know they were baptized this way, and on that form we asked them to let us know who baptized them. The Baptizers field is a matrix attribute, and we didn't know how many people would be in the water with them. So in order to store each baptizer as an individual person on another matrix attribute on their profile, we had to loop through each baptizer listed and create / match a profile.{% assign matrix = Workflow | Attribute:'fe-baptizers','Object' %} // Matrix type{% assign person = Workflow | Attribute:'wf-person','Object' %} // Person type{% assign stringofbaptizers = '' %}{% for row in matrix.AttributeMatrixItems %} {% assign firstname = row | Attribute:'FirstName' %} {% assign lastname = row | Attribute:'LastName' %} {% assign email = row | Attribute:'Email' %} {% assign phone = row | Attribute:'PhoneNumber','RawValue' %} {% assign gender = row | Attribute:'Gender','RawValue' %} {% workflowactivate workflowtype:'185' FirstName:'{{ firstname }}' LastName:'{{ lastname }}' Email:'{{ email }}' PhoneNumber:'{{ phone }}' Gender:'{{ gender }}' %} {% assign baptizer = Workflow | Attribute:'Person','RawValue' %} // notice I'm getting back from the workflow that was activated a person object. 'Person' is an attribute in workflow type 185. {% assign stringofbaptizers = stringofbaptizers | Append:baptizer %} {% if forloop.last == false %} {% assign stringofbaptizers = stringofbaptizers | Append:',' %} {% endif %} {% endworkflowactivate %}{% endfor %}Add Step to Person (Id:206 in example)This workflow was actually created for two reasons. One, we needed a way to backfill steps, so this was an easy to way to do that. Second, we have a new member course called Discover Northside that's available to watch online. Discover Northside is a step in our "Engagement Pathway" step program, but we knew with a digital platform it would be likely that couples or friends would watch it together instead of individually. We wanted a way for each person who watched it to get "credit" for watching it, so at the end of the course they have an option to add a list of people they watched with (it's just a matrix attribute). Of course, we didn't know how many people would be in the list and had to loop over it to 1) create a new person or match existing and then 2) add the step to the person's profile.{% assign person = Workflow | Attribute:'Person','Object' %} // Person type{% assign steptype = Workflow | Attribute:'DiscoverNorthsideStep','RawValue' %} // Step Program Step Type type{% assign stepstatus = Workflow | Attribute:'CompletedStepStatus','RawValue' %} // Step Program Step Status type{% assign campus = Workflow | Attribute:'Campus','RawValue' %} // Campus type{% assign today = 'Now' | Date:'yyyy-MM-ddT00:00:00' %}{% workflowactivate workflowtype:'206' workflowname:'{{ person.FullName }} Add Step - Discover Northside' Person:'{{ person.PrimaryAlias.Guid }}' StepType:'{{ steptype }}' StepStatus:'{{ stepstatus }}' Campus:'{{ campus }}' StartDate:'{{ today }}' %} Activated new workflow with the id of #{{ Workflow.Id }} and name of {{ Workflow.Name }}.{% endworkflowactivate %}{% assign matrix = Workflow | Attribute:'WatchedWith','Object' %}{% for row in matrix.AttributeMatrixItems %} {% assign firstname = row | Attribute:'FirstName' %} {% assign lastname = row | Attribute:'LastName' %} {% assign email = row | Attribute:'Email','RawValue' %} {% assign phone = row | Attribute:'PhoneNumber','RawValue' %} {% assign gender = row | Attribute:'Gender','RawValue' %} {% workflowactivate workflowtype:'185' FirstName:'{{ firstname }}' LastName:'{{ lastname }}' Email:'{{ email }}' PhoneNumber:'{{ phone }}' Gender:'{{ gender }}' %} {% assign watcher = Workflow | Attribute:'Person','Object' %} {% workflowactivate workflowtype:'206' workflowname:'{{ watcher.FullName }} Add Step - Discover Northside' Person:'{{ watcher.PrimaryAlias.Guid }}' StepType:'{{ steptype }}' StepStatus:'{{ stepstatus }}' Campus:'{{ campus }} ' StartDate:'{{ today }}' %} Activated new workflow with the id of #{{ Workflow.Id }} and name of {{ Workflow.Name }}. {% endworkflowactivate %} {% endworkflowactivate %}{% endfor %}Add Person to Group as Active w/up to 3 member attributes (Id:162 in example)We use this one for a number of different scenarios! Two of the most common are a communication list subscription workflow and a serving team sign-up workflow. For the communication list subscription, you may be asking, isn't there a built-in block that allows you to subscribe to communication lists? Yes, there is, however it requires that people be logged in. We aren't at a place yet with our attendees to have them have an account, so we had to create a workflow that would list the communication lists and ask for their name and email. We then had to loop through which ones they subscribed to and used this helper workflow to add them to the subscription list.{% assign lists = Workflow | Attribute:'wf-lists','RawValue' | Split:',' %} // Multi-Select type with Group guids{% assign person = Workflow | Attribute:'wf-person','Object' %} // Person type{% for list in lists %} {% workflowactivate workflowtype:'162' Person:'{{ person.PrimaryAlias.Guid }}' Group:'{{ list }}' %} Activated new workflow with the id of #{{ Workflow.Id }} and name of {{ Workflow.Name }}. {% endworkflowactivate %}{% endfor %}For the serving team sign-up, we had a specific ministry that wanted their volunteers to be able to sign-up to serve on a form when we reopened after the initial COVID shutdown. Because they allowed their volunteers to serve in multiple areas, and we wanted to grab specific serving team info (like service rotation or shift), we used a matrix attribute to collect that. Then, we looped through what serving areas they picked and used this helper workflow to then add them.{% assign person = Workflow | Attribute:'wf-person','Object' %} // Person type{% assign servicerotation = Workflow | Attribute:'fe-rotation','RawValue' %} // Single-Select type{% assign gmservicerotation = Workflow | Attribute:'wf-gmattr-servicerotation','RawValue' %} // Attribute type{% assign gmservice = Workflow | Attribute:'wf-gmattr-service','RawValue' %} // Attribute type{% assign matrix = Workflow | Attribute:'fe-matrixteam','Object' %} // Matrix type{% for row in matrix.AttributeMatrixItems %} {% assign group = row | Attribute:'ServingTeam','RawValue' %} {% assign service = row | Attribute:'ServiceTime','RawValue' %} {% workflowactivate workflowtype:'162' Person:'{{ person.PrimaryAlias.Guid }}' GroupAttributetoSet:'{{ gmservicerotation }}' GroupAttributeValue:'{{ servicerotation }}' GroupAttribute2toSet:'{{ gmservice }}' GroupAttribute2Value:'{{ service }}' Group:'{{ group }}' %} Activated new workflow with the id of #{{ Workflow.Id }} and name of {{ Workflow.Name }}. {% endworkflowactivate %}{% endfor %}Send SMS (Id:282 in example)We setup for our student ministry team an "add to roster" workflow that a new group member could fill out. When they filled it out, it not only added them to that group's roster, but also texted each leader the new student's contact info and birthdate. Since the number of leaders is variable, we needed to be able to loop through each leader and text them the appropriate info.{% assign message = Workflow | Attribute:'LeaderText' %} // Text type{% assign group = Workflow | Attribute:'GroupToJoin','Object' %} // Group type{% for member in group.Members %} {% if member.GroupRoleId == 145 or member.GroupRoleId == 87 %} // Checks for leader role ids {% workflowactivate workflowtype:'282' recipient:'{{ member.Person.PrimaryAlias.Guid }}' message:'{{ message }}' %} Activated new workflow with the id of #{{ Workflow.Id }} and name of {{ Workflow.Name }}. {% endworkflowactivate %} {% endif %}{% endfor %} Download File