Skip to main content

Auto-Cancel Alumni Tasks on New Opportunity (CRM)

When a new Opportunity is created for a returning Contact, this feature automatically cancels matching open tasks from previous Opportunities based on rules you configure. Cancelled tasks go to the Recycle Bin and can be restored if needed.

Before You Begin

Who can configure this feature:

Role

Can Configure

Affected by Cancellation

Administrator

Yes

Yes — their open tasks may be auto-cancelled

Manager

No

Yes

Standard User

No

Yes

Requirements before setup:

  • You must be signed in as a CRM Administrator

  • LightningStep, Alleva, or another EMR connection is not required — this feature is EMR-agnostic

  • The one-time installation script must be run on your instance before the settings panel is accessible (see Step 1 below)

  • At least one filter (Task Type or Subject) must be configured before cancellations will run — leaving both filters empty is a built-in safety guard that prevents accidental mass-cancellation


Steps

Step 1 — Run the One-Time Installation Script (Per Instance)

Before the feature can be configured, a setup script must be run once per CRM instance to create the settings table and seed the default configuration row. This step is performed by your CRM developer or DBA.

Ask your developer or DBA to run the following:

php integration/Sprint100/create_workflows_settings.php

What this script does:

  • Creates the workflows_settings table if it does not already exist

  • Inserts the default row with the toggle set to disabled and the Subject field pre-seeded with "Alumni Follow up"

  • Safe to run multiple times — it is fully idempotent and will not duplicate data

After the script runs, the Workflows Settings button will appear in the Workflows list view toolbar and the Subject field will be pre-populated with the "Alumni Follow up" tag — ready to use out of the box for the alumni use case.

If the Workflows Settings button is not visible after the script has been run, ask IT to clear the Smarty template cache after the latest deployment, then refresh the page with Ctrl+F5.


Step 2 — Access the Workflows Settings Panel

  1. Sign in as an Administrator

  2. Go to Settings → CRM Settings → Automation → Workflow

  3. On the Workflows list view, click the Workflows Settings button in the top toolbar

The Workflows Settings modal opens. It contains three controls:

Control

Purpose

Enabled toggle

Master switch. When OFF, no cancellations run regardless of any other settings. When ON, the filters below apply.

Task Type (multi-select)

Restricts cancellation to tasks of the chosen Calendar Task Type(s) only — e.g. Followup Call, Alumni Callback. Leave empty to match all task types (Subject filter must then be configured).

Subject (taggable field)

Free-text input. Type a subject title and press Enter (or comma) to add it as a tag chip. Add as many subjects as needed. Remove a tag by clicking the × on its chip.


Step 3 — Configure the Auto-Cancel Rules

  1. In the Workflows Settings modal, toggle Enable auto-cancel to ON

  2. Optionally select one or more values from the Task Type dropdown to restrict cancellation to specific task types

  3. In the Subject field, the default tag "Alumni Follow up" is pre-loaded — add more by typing a subject title and pressing Enter, or remove a tag by clicking the × on its chip

  4. Click Save

  5. A success message confirms your settings were stored: "Settings saved successfully."

💡 You can re-open the Workflows Settings modal at any time. Your saved selections — toggle state, task types, and subjects — are pre-loaded so you can review or update them without starting from scratch.

How the two filters work together:

Task Type Filter

Subject Filter

Result

Empty

Empty

No cancellations run — the system stops here as a safety guard against accidental mass-cancellation

Selected

Empty

Only tasks of the selected Task Type(s) are cancelled, regardless of subject

Empty

Configured

Only tasks whose subject matches one of the configured subjects are cancelled, regardless of task type

Selected

Configured

Both filters apply — a task must match a configured Type AND a configured Subject to be cancelled. This is the narrowest and safest configuration.


Verification / Expected Result

Once the toggle is on and at least one filter is configured, the feature runs automatically in the background. There is nothing else to enable.

When a new Opportunity is saved for the first time, the system runs the following logic in order:

  1. Is the feature toggle ON? If not, stop — no cancellations run

  2. Are both the Task Type and Subject filters empty? If yes, stop — safety guard prevents mass-cancellation

  3. Does the new Opportunity have a Contact linked? If not, stop

  4. Find all other non-deleted Opportunities for the same Contact

  5. For each older Opportunity, find all open Calendar tasks with status Open or Not Started

  6. Apply the Subject filter against configured subject titles (case-insensitive exact match)

  7. Cancel every task that matches both active filters — tasks are moved to the Recycle Bin

Subject matching behavior: Subject matching is case-insensitive and exact. For example, a configured subject of "Alumni Follow up" will match tasks titled "alumni follow up" or "ALUMNI FOLLOW UP" but will not match "Alumni Follow up Call" (partial match).

⚠️ Purely dynamic subject values — for example, a subject containing only {$potentialname} with no surrounding static text — will never match anything. The remaining static text after stripping variables must be non-empty for a match to occur.


Troubleshooting / Common Errors

The "Workflows Settings" button is not visible

  • Confirm you are signed in as an Administrator

  • Refresh the Workflows list page with Ctrl+F5

  • Confirm the installation script in Step 1 has been run on this instance

  • Ask IT to clear the Smarty template cache after the latest deployment


The Task Type dropdown is empty

The Task Type dropdown is populated from the Calendar module's Task Type picklist. If it is empty, no picklist values have been configured for that field. Add values via Settings → Picklist Editor → Calendar → Task Type, then reopen the modal.


Saved settings do not appear to persist

  • Watch for the green success message after clicking Save — if it does not appear, the save did not complete

  • Re-open the modal — saved values should be pre-loaded on reopen

  • If values are not pre-loaded, open the browser console (F12) and look for AJAX errors, then report them to IT


Subject tag chips are showing encoded characters (e.g. ")

This indicates a database encoding issue when reading the saved JSON. It should be resolved by the latest deployment (the fix uses fetchByAssoc with encode=false). If the issue persists, contact IT to verify the latest code version is deployed on your instance.


New Opportunities are being saved but no tasks are being cancelled

Work through this checklist in order:

  • Confirm the Enable auto-cancel toggle is ON in the Workflows Settings modal

  • Confirm the new Opportunity has a Contact linked — the feature does not run without one

  • Confirm the linked Contact has at least one other non-deleted Opportunity

  • Confirm there are open tasks on those older Opportunities with status Open or Not Started specifically — tasks with status In Progress are not affected

  • Confirm at least one filter (Task Type or Subject) is configured — the feature stops when both are empty

  • If a Task Type filter is set, verify that the task type values in the filter exactly match the Calendar picklist values


Too many tasks were cancelled

  • Affected tasks can be restored from the Calendar Recycle Bin

  • To prevent recurrence, tighten your filters — add a specific Task Type and/or specific Subject values to narrow the scope before saving the configuration again


Tips & Notes

Cancellation is recoverable. Cancelled tasks are moved to the standard CRM Recycle Bin using the same trash mechanism as manual deletions. They are not permanently deleted and can be restored by an Administrator if needed.

The feature only triggers on first save. Auto-cancellation runs once, on the initial save of a new Opportunity. Subsequent edits to that same Opportunity do not re-trigger the cancellation logic.

Both filters are optional but not both empty. You can configure Task Type only, Subject only, or both together. The only combination that produces no result is leaving both fields empty — which is intentional behavior to protect against accidental mass-cancellation.

The default subject works out of the box. The pre-seeded subject "Alumni Follow up" is designed to cover the most common alumni re-admission scenario with no additional configuration. Simply turn the toggle on and save to activate it immediately.


Did this answer your question?