> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wegive.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Tags

> Mapping between WeGive Tags and tag assignments and the Tag and Tag Donor custom objects in the WeGive4SF package

WeGive syncs tags to two custom objects that ship with the WeGive4SF managed package: one for the tag itself and one for each assignment of a tag to a donor.

| WeGive record | Salesforce object | What it holds | Direction |
| - | - | - | - |
| Tag | `wegive__Tag__c` | The tag definition: name and settings | WeGive to Salesforce only |
| Tag assignment | `wegive__Tag_Donor__c` | One donor's membership in one tag | Both directions |

<Note>
  These objects require WeGive4SF to be installed. See [Installing the WeGive Salesforce Managed Package](/external/onboarding/salesforce-npsp/install-setup/package-install).
</Note>

## What tags are in WeGive

A tag in WeGive is a named label applied to donors, either by hand or automatically by rules (for example, "gave in the last 90 days" or "registered for the gala"). Tags drive segmentation for communications, audience filters, journeys, and reporting. Syncing them to Salesforce lets Salesforce users see, report on, and act on the same segments, and, for assignments, lets Salesforce users add or remove donors from a tag.

## Sync direction

**Tag definitions are push-only.** WeGive creates and updates `wegive__Tag__c` records but never reads them back. A tag created directly in Salesforce is not imported into WeGive, and edits to a tag's name or settings in Salesforce are overwritten on WeGive's next push of that tag.

**Tag assignments sync in both directions.** WeGive pushes every assignment it creates or removes. When the assignment pull setting is enabled, WeGive also reads `wegive__Tag_Donor__c` records modified in Salesforce and applies them: a new record tags the donor in WeGive, and a record with a deleted timestamp (or a record that was hard-deleted in Salesforce) removes the tag from the donor.

This means a Salesforce user can tag a Contact by creating a Tag Donor record that points at an existing Tag and Contact, and the donor will carry that tag in WeGive within the next pull cycle.

### Create versus update

Each WeGive tag and assignment stores the Salesforce ID of its counterpart. If the ID is present, WeGive updates that record. If it is absent, WeGive creates one and stores the returned ID. Tag assignments are created with an **upsert** on the external ID field `wegive__WeGive_Id__c`, so a retried push cannot produce a duplicate assignment. WeGive also holds a lock per record during creation to prevent duplicates from concurrent updates.

### Parent records are pushed first

Before pushing an assignment, WeGive pushes any parent that does not yet have a Salesforce ID: the tag, and the donor (Contact for an individual, Account for a company).

### Deletions

When a tag or an assignment is removed in WeGive, the Salesforce record is **not** deleted. WeGive stamps `wegive__Deleted_DateTime__c` instead, so history is preserved and reports can distinguish current from former members.

On pull, WeGive mirrors the same convention: a `wegive__Tag_Donor__c` record with `wegive__Deleted_DateTime__c` populated removes the tag from the donor in WeGive, and clearing that field restores it. Records that are hard-deleted in Salesforce are also detected and remove the assignment in WeGive.

## Sync settings

Tag sync is off by default and is enabled in two places.

| Setting | Where | Controls |
| - | - | - |
| **Push tag memberships to Salesforce** | Sync Configuration > Entity Pull & Push | Whether WeGive pushes tags and assignments at all. Assignments are pushed through the bulk upload pipeline. |
| **Sync to CRM** | On each individual tag | Per-tag opt-in. Only tags with this toggle on are pushed, along with their assignments. Tags without it stay in WeGive only. |
| **Pull tag memberships from Salesforce** | Sync Configuration > Entity Pull & Push | Whether WeGive reads `wegive__Tag_Donor__c` changes from Salesforce and mirrors them onto donors, including deleted timestamps and hard-deleted records. |

Both integration-level toggles are off by default. Turn on the push toggle first, then opt in the specific tags the organization wants in Salesforce. Turning on the pull toggle without the push toggle is valid but unusual; assignments created in Salesforce would flow into WeGive while WeGive's own tagging stays local.

## Tag

**Salesforce object:** `wegive__Tag__c`

| Salesforce field | WeGive field | Notes |
| - | - | - |
| `Name` | Tag name | Truncated to 80 characters |
| `wegive__Published__c` | Published | Whether the tag is active in WeGive |
| `wegive__Remove_Donors__c` | Remove donors | For rule-based tags, whether donors are removed from the tag when they stop matching its rules |
| `wegive__WeGive_Id__c` | Tag ID | The WeGive tag ID |
| `wegive__Deleted_DateTime__c` | Deleted at | Populated when the tag is deleted in WeGive |

`Published` mirrors WeGive's own `published` flag on the tag record (`Tag::boot()`'s `saved` hook only dispatches `CheckIfTaggingAppliesToExistingDonors` — the job that (re)applies the tag's entry rules to the donor base — when `published` is true), so a published tag is one actively being applied by its rules in WeGive, not merely a Salesforce-side visibility setting.

## Tag Donor (assignment)

**Salesforce object:** `wegive__Tag_Donor__c`

One record per donor per tag.

| Salesforce field | WeGive field | Notes |
| - | - | - |
| `wegive__Tag__c` | Tag | Lookup to the parent `wegive__Tag__c` |
| `wegive__Donor__c` | Donor (individual) | Lookup to Contact. Populated for individual donors only. |
| `wegive__Account__c` | Donor (company) | Lookup to Account. Populated for company donors only. |
| `wegive__WeGive_Id__c` | External ID | A composite identifier for the assignment. Used as the upsert key on push and to match records on pull. |
| `wegive__WeGive_Tag_Id__c` | Tag ID | The WeGive tag ID, as text |
| `wegive__WeGive_Donor_Id__c` | Donor ID | The WeGive donor ID, as text |
| `wegive__WeGive_Organization_Id__c` | Organization ID | The WeGive organization ID |
| `wegive__Deleted_DateTime__c` | Deleted at | Populated when the assignment is removed. See [Deletions](#deletions). |

Exactly one of `wegive__Donor__c` and `wegive__Account__c` is populated on each record, depending on whether the tagged donor is an individual or a company.

## Creating assignments from Salesforce

To tag a donor from the Salesforce side, create a `wegive__Tag_Donor__c` record with:

* `wegive__Tag__c` set to a Tag that WeGive has already pushed (it must have a `wegive__WeGive_Id__c`)
* Either `wegive__Donor__c` (Contact) or `wegive__Account__c` (Account) set to a record that is already synced to WeGive

Leave the WeGive ID fields blank; WeGive fills them on the next push after import. To remove the assignment from Salesforce, set `wegive__Deleted_DateTime__c` rather than deleting the record, so the change flows to WeGive with history intact. Deleting the record also works when the deleted-record pull setting is on.

Tag assignments do not support custom mapping rules. The fields above are the complete set.

## Troubleshooting

**A tag created in Salesforce does not appear in WeGive.** Expected. Tag definitions are push-only. Create the tag in WeGive; it will appear in Salesforce on the next push.

**A tag in WeGive never appears in Salesforce.** Either **Push tag memberships to Salesforce** is off under Sync Configuration, or the tag's own **Sync to CRM** toggle is off. Both must be on.

**An assignment created in Salesforce fails to import with "Unable to find tag" or "Unable to find donor."** The Tag or the Contact/Account it references has not been synced to WeGive yet. Both parents must exist on the WeGive side before the assignment can be imported. Confirm the Tag has a `wegive__WeGive_Id__c` and the Contact or Account has synced, then edit the Tag Donor record to trigger another pull.

**A donor was removed from a tag in WeGive but the Tag Donor record is still in Salesforce.** Expected. WeGive stamps `wegive__Deleted_DateTime__c` instead of deleting. Filter reports on that field being blank to see current members.

**A rule-based tag keeps re-adding a donor that was removed in Salesforce.** The tag's rules in WeGive still match the donor. Removing an assignment in Salesforce is a one-time action; if the donor still qualifies, WeGive's tagging rules will reapply the tag and push a fresh assignment. Adjust the rule or the donor's data in WeGive instead.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.