Automatically find every contact whose Contact Custom Field matches a specific value and add each of them to a Contact Group, using two connected HappyFox Workflows built around a recurring Scheduled Ticket. The solution does not stop after updating a single contact — it runs repeatedly until every matching contact has been added to the group.
Prerequisites
- A Contact Custom Field must already exist. See What are contact custom fields?
- A Contact Group must already exist. See Manage contact groups
- A Scheduled Ticket must be configured in HappyFox Help Desk to recur periodically (say every day). See Scheduled Tickets: Automate ticket creation in HappyFox to set one up.
- You need access to the Filter Contacts and Add Contact To Groups actions when building a workflow.
Note: HappyFox Workflows does not currently support a Contact Created or Contact Updated trigger. This solution uses a Scheduled Ticket as a recurring clock instead — the ticket is created or updated on a schedule, and each time it fires, the workflow processes one more matching contact.
Example use case
An organization has a Contact Custom Field named Is Admin. Whenever a contact's Is Admin value is Yes, that contact should be added to the Admin Contact Group. This ensures only contacts in the Admin Contact Group can access specific Support Center features.
Another contact custom field called Added to Group with Yes/No as values.
How the solution works
The solution is not a single workflow — it is two workflows that hand off to each other, plus a recurring Scheduled Ticket that keeps the handoff running:
- Workflow 1 (Ticket Created) runs once, when the Scheduled Ticket is first created. It filters contacts, adds the first matching contact to the group, and then updates the ticket to hand off to Workflow 2.
- Workflow 2 (Ticket Updated) runs every time the ticket is subsequently updated. It repeats the same filter-and-add step for the next unprocessed contact, then updates the ticket again to trigger itself.
Each execution processes exactly one contact. Add Contact To Groups only acts on the first contact returned by Filter Contacts in that run — it does not add every returned contact at once. The workflow re-triggers itself by updating the ticket, and each re-trigger picks up the next contact in line, because the contact just added no longer matches the Filter Contacts condition. The loop continues, one contact per run, until Filter Contacts returns no results, at which point the ticket stops updating and the process ends on its own.
Note: HappyFox Workflows does not cap the number of times a ticket can re-trigger a workflow through repeated updates, so this loop is not limited by a run-count ceiling. It keeps running until every matching contact has been processed.
Workflow 1 — Ticket Created
Trigger: Ticket Created
This workflow is initiated by the Scheduled Ticket.
-
Add a Filter Contacts action with the following condition under Match All:
- Is Admin is Yes
- Contact is not part of the Admin Contact Group
This returns every matching contact as an indexed array of results (
0,1,2, and so on), each with fields like Id and Name. For example: Contact A at index0, Contact B at index1, Contact C at index2. -
Add an Add Contact To Groups action.
- In Step 1, set Contact ID to the Filter Contacts merge field for index
0's Id value (the first contact in the array). This is what limits the action to one contact instead of the whole list. - In Step 2, set Contact Groups to the Admin Contact Group.
After this step, Contact A becomes a member of the Admin Contact Group.
- In Step 1, set Contact ID to the Filter Contacts merge field for index
-
Update Contact Custom Field Added to Group as Yes
-
Add an Update Ticket action to update the Scheduled Ticket.
Updating the ticket triggers Workflow 2.
Workflow 2 — Ticket Updated
Trigger: Ticket Updated
This workflow repeats the same process as Workflow 1.
-
Add the same Filter Contacts action:
Contact A is now excluded automatically, since it was already added to the group in the previous run. The filtered result is now Contact B at index
0, Contact C at index1.- Is Admin is Yes
- Added to Group is No
-
Check Condition If Filter Contact action has a valid result
-
Add the same Add Contact To Groups action, mapped the same way: Contact ID set to index
0's Id value, Contact Groups set to the Admin Contact Group. It adds Contact B, now the first contact in the current result, to the Admin Contact Group. -
Update Contact custom field Added to Group as Yes for contact B using Update Contact action.
-
Add the same Update Ticket action to update the Scheduled Ticket again, which triggers Workflow 2 to run once more.
-
Note: The workflow continues until Filter Contacts returns no contacts. At that point, no further ticket update occurs and processing stops automatically. No manual intervention is required to end the loop.
Example run
| Contact | Is Admin | Added to Group |
|---|---|---|
| Contact A | Yes | No |
| Contact B | Yes | No |
| Contact C | Yes | No |
- First execution: Contact A is added to the Admin Group.
- Second execution: Contact B is added to the Admin Group.
- Third execution: Contact C is added to the Admin Group.
- Fourth execution: Filter Contacts returns no matching contacts. The workflow stops.
Benefits
- Fully automated Contact Group management with no manual intervention.
- Uses only native HappyFox Workflows actions.
- Avoids duplicate additions, since Filter Contacts excludes contacts already in the target Contact Group.
- Can be adapted to other Contact Groups by changing the Filter Contacts conditions.