Skip to main content

Using CiviRules with Cases

A simple example of how you can automate Cases with CiviRules

C
Written by CiviPlus Helpdesk
Updated over a week ago

Introduction

To increase the efficiency of your team working through set workflows, you may wish to add automation to your CiviPlus processes.

CiviRules is an automation tool, accessible to administrators, that allows the setting up of tasks or actions that the system will run automatically, when triggered by specific conditions. This is very useful for the automation of tasks that should always happen under certain conditions.

Each CiviRule has three components, described in more detail within the article

  • Trigger: “What event starts the rule — like when a contact is created or a contribution is made.”

  • Condition(s): “Checks that must be true for the rule to continue — like contact type is ‘Individual’.”

  • Action(s): “What happens if the conditions are met — like send an email or update a field.

Using CiviRules for automation, in particular send emails, is covered in detail within the following articles which we recommend you read before continuing.

A very important cautionary note: with great power comes great responsibility!

CiviRules is an extremely flexible and very useful, but very powerful tool. Without extra care, or by leaving a rule you are working on setting up 'unfinished', you run the risk of creating a problematic automation that runs unsupervised in the background on your site.

Remember, CiviRules run:

All the time

Unsupervised

For all contacts/data

…a small mistake (for example, not including a 'condition' for your rule) can cause major issues, such as -

  • Sending large volumes of unintended emails

  • Updating and overwrite valuable data

  • Jamming/ slowing the site with thousands of tasks

There are countless ways that you can use CiviRules within the context of a Case. Just some examples are:

New Case Acknowledgement

Trigger: Case created

Action: Send acknowledgement email to client using a template with [case.manager] token.

Appointment Reminder

Trigger: Activity of type Assessment scheduled

Action: Send reminder 2 days before with [activity.date_time] token.

Case Closure Notice

Trigger: Case status changed to Closed

Action: Send closure email with [case.subject] and [case.manager].

Example CiviRule for Cases

For this article we will use a simple example to show how easy it is to create a CiviRule that automatically send an email using the "Notification of Support Assessment" template created in the article here

Firstly, navigate to Administer -> CiviRules -> Manage Rules and either click Add Rule or Edit Rule if you want to change an existing one.

We now start to define the rule:

Firstly, give the CiviRule a Name and Description, and then in the Linked Trigger option select "Case activity is added".

When you click Next you will be asked to specify which contact(s) in the activity the rule should be Triggered for. In our example we want an email to be sent to the Case Client only, and so we select "Activity Targets".

Having specified the Trigger for this rule (new Activity) we need to specific the Conditions (i.e. what kind of Activity), so click ADD CONDITION to do this

The first condition relates to the Case Type that we are interested in. "Select Case is (not) one of types" and click SAVE.

Now we choose the "Client Support" Case Type from the list of cases in the Operator drop down list and then click the SAVE button.

We want to make sure that it is the right type of Activity that will trigger this rule, so we add another condition to the rule that says the Activity is of type "Open Case"

Having configured the Linked Trigger and Linked Conditions the last thing we need to specify what the Linked Action is.

For Select Action select "Send Email", and as we want it sent straight away set Delay Action to "No Delay".

The last bit of configuration to do is complete the CiviRules Edit Action parameters page. Since we are using an email template this is pretty simple, just select "Notification of Support Assessment" from the drop down list in the Message Template field, and in this example we are going to "File email on Case" as well.

Once you click SAVE the new CiviRule is complete:

The next time a new Activity Type of "Open Case" is created within a Case Type of "Client Support" an email will immediately be sent to the Target Contact (Case Client) using the Mail template "Notification of Support Assessment" and filed on the Case.

Did this answer your question?