Create a list or text string of volunteer types in the auto-response email form a volunteer page?

I found this on the Signup Variables page -- volunteers_types An array of volunteer_type objects, volunteer roles this person has signed up for --. Can this be used to propagate a list in the auto-response email comprised of the selections form a volunteer page? If it can, can anyone give me a clue what the code might look like? Thanks, Bob

completed

Hey Bob! That array will show all of the volunteer types available on the page and there is another array that will show all of the volunteer types that the recipient has ever signed up for (on any page). So using the "capture", "assign" and "if x contains" liquid tags, we can cross reference those arrays to see which volunteer roles appear on that volunteer signup page that the user has signed up for, like so:

{% capture volunteer_roles_list %}{% for volunteer_type in page.volunteer_signup.volunteer_types %}{{ volunteer_type.name }}{% unless forloop.last %}||{% endunless %}{% endfor %}{% endcapture %}{% assign volunteer_roles = volunteer_roles_list | split: '||' %}

Thank you for volunteering for the following roles:

{% for volunteer_type in recipient.volunteer_types %}{% if volunteer_roles contains volunteer_type.name %}B - {{ volunteer_type.name }}
{% endif %}{% endfor %}

 

In case the formatting of that code doesn't save properly, I've also added that code here: https://gist.github.com/bpalm/c1ad4195f193b3c535336f0ec83a7dbb

Official response from

Share this post

Showing 3 reactions

How would you tag this suggestion?
Please check your e-mail for a link to activate your account.