The Goal

Hi! Have you ever generated a report or pulled up a group of kids and clicked the communicate icon, just to remember that you actually want to communicate with their parents? This recipe will walk you through creating a “Send to Parents” button in your communication wizard which will remove all of the recipients from the communication and replace them with their parents.


To make this magic happen, we’ll follow 2 steps:

  1. Create a workflow
  2. Add some JavaScript to your communication wizard block

The Workflow

Import this workflow. Note: you may need to edit, then save the workflow for the import to work correctly.

The workflow has 4 actions:

  1. If no CommunicationId is passed to the workflow, it will cancel the workflow. This protects against you accidentally triggering it. The SQL later on should be safe without this, but why risk it?
  2. Set Redirect Url - This will set the redirect to take you back to the communication wizard once the recipients have been swapped. *** You should check that the link this creates is correct for your instance. ***
  3. SQL Run - This is where the actual work happens. The SQL does 3 things:
    1. Creates a temporary table that stores all of the current recipient’s parents (a PersonAliasId for each of them).
    2. Deletes all of the current recipients (CommunicationRecipient entities)
    3. Inserts new recipients (CommunicationRecipient entities) for each of the parents stored in the temporary table.
  4. Redirect - This redirects you back to the communication wizard.

The JavaScript

We'll use JavaScript to add the button to the page. Go to your Communication Page and edit the block settings for the Communication Entry Wizard block. Under Advanced Settings, in the Post-HTML field, paste this code:

var communicationId = window.location.pathname.split('/').pop();
$('div[id*="HeadingLabels"]').prepend('<div class="label label-primary"><a href="{{ 'Global' | Attribute:'InternalApplicationRoot' }}WorkflowEntry/953?CommunicationId=' + communicationId + '">Send to Parents</a></div>');

*** Make sure you replace the Id number in the link (the 953 in this example) with the WorkflowType Id of the workflow you created. Also, verify that this is the correct internal workflow entry url for your instance. ***

This will read the communication id from the url and create a link to run your workflow similar to the image at the top of this document. Once you’ve done this, try pulling up a list of kids and test it out.

Final Thoughts

  • Be aware that this is using the same logic that Rock does to pull “parents”, so it will return all adults in all families the original recipients are in.
  • You should consider the security settings on the workflow type, since by default anyone can run a workflow. I would recommend locking it down similarly to the Communication Entry Wizard block.
  • If you have any questions or comments, feel free to reach out via @david.axelson