Skip to main content

Segments

How to tag contacts and accounts with segments and keep Salesforce Campaigns in step with them.

Overview​

A segment is a label you put on a contact or an account. Newsletter, Major Donor, Volunteer, and 2026 Gala could all be segments. Segments live in a multi-select picklist field, and the Segment Picker puts that field on a record page as a row of clickable pills.

The second half is Campaign sync. Each segment goes with the Salesforce Campaign of the same name, and sync keeps the two in agreement. Tag someone Volunteer and they become a member of the Volunteer campaign. Fundraisers manage campaign membership by clicking labels without opening a campaign.

Segments and campaigns are matched by name alone. The segment Volunteer goes with the campaign named exactly Volunteer. Rename either one and the link breaks without a warning.

The picker also runs in a Flourish Core portal. See In a portal.


Adding it to a page​

The package has no segment field of its own. Point the component at a multi-select picklist your org already has. That's what lets one component drive different fields on different pages.

In the Lightning App Builder, drag Flourish Core: Segment Picker onto a record page.

SettingWhat it does
Multiselect Field API NameRequired. The multi-select picklist that holds the segments, such as My_Segments__c. You can also name a field one relationship away, such as Account.My_Segments__c.
Card TitleThe heading on the card. Defaults to Segments.
Enable Campaign syncShows the Sync to Campaigns button. Off by default.
Account Contact Fields (Campaign sync)Used only for accounts. See Tagging an account.

Sync looks only at Contact and Account. Of those, it looks only at whichever has the field. You can put the picker on another object's record page to edit a field there, but nothing syncs.


Tagging a record​

The card shows a pill for every segment, and the ones already on the record are highlighted.

  1. Click pills to select and deselect them. Nothing is saved yet.
  2. Click Save. A Saved confirmation appears.

If you leave the page without saving, your choices are lost.

Adding a segment nobody has used yet​

Type the name in Add a new option and click Add or press Enter.

This adds the value to the field itself for everyone, so it changes your org and not only this record. It's selected on the record you're on straight away, and a confirmation names it. Typing one that already exists warns you and adds nothing.

Save afterwards. Adding an option selects it on screen, but the record keeps it only once you click Save.

Two things can stop Add from working:

  • It needs the org's connection credentials. Adding a picklist value changes your org's setup, so it uses the Client Id and Client Secret from the connection wizard in Setup and the OrgDomain remote site. Without the credentials, Add fails with a message saying to fill in Client Id and Client Secret. Choosing and saving existing segments still works.
  • Add can't change a field that uses a global value set. As the message says, add those values in Setup. Everything else about the picker still works.

If the same field name exists on both Contact and Account, a new value is added to both, so the two stay in step.


Keeping Campaigns in step​

With Enable Campaign sync on, the card's header has a Sync to Campaigns button.

It syncs the whole org, not only the record you're on. A run goes over every contact and account that has the field and every campaign that matches. Expect it to fix things you weren't looking at.

It saves the pills on screen first, so what you see is what syncs.

A run does this:

  1. Finds every contact and account with a segment on it.
  2. Works out the segments in play: every value defined on the field, every value on a record, and every campaign already opted into sync.
  3. Matches each segment to the campaign with that name.
  4. Creates any missing campaign, but only for a segment with at least one member. An empty segment doesn't make an empty campaign.
  5. Adds and removes campaign members, or adds and removes segments on records, according to each campaign's direction. See Which side wins.

A new campaign is created Active and set to Record Controls.

When it finishes, Sync complete reports five numbers: campaigns created, members added, members removed, contacts updated, and accounts updated. Anything else it has to tell you comes in a second message, Sync notes, which stays on screen until you close it.

A row that fails doesn't stop the run. If a few members or records can't be saved, the rest still go through and the failures show in the notes.


Which side wins​

When a record and a campaign disagree, each campaign decides which side wins with its Segment Sync Direction field.

DirectionWhat decides
Record ControlsThe segments on the record. Members are added and removed to match.
Campaign ControlsThe campaign's member list. Segments are added to and removed from records to match.
BlankTreated as Record Controls.

Record Controls is the usual choice. Campaigns that sync creates start with it. Someone tagged Volunteer is added to the Volunteer campaign, and someone who loses the tag is removed from it.

Campaign Controls is for a campaign you manage directly by list import or with Salesforce's campaign tools. Add someone as a member and they gain the segment. Remove them and they lose it.

Setting a direction also opts a campaign into sync. That matters for Campaign Controls because such a campaign syncs even when nobody has its segment yet. That's how it puts its segment on its members the first time.


Tagging an account​

Salesforce accounts can't be campaign members. Only contacts and leads can. So when an account has a segment, its contacts join the campaign.

You decide which contacts. Account Contact Fields (Campaign sync) takes a comma-separated list of Account's contact lookup fields. A primary contact lookup is the usual one. The contacts those fields point to become members on the account's behalf.

Leave it blank, or leave those fields empty on the account, and the account adds no members. Nothing reports the skip, so an account with a segment and no contact in those fields does nothing without saying so.

Under Campaign Controls, it works the other way. An account gains the segment when any contact in those fields is a member of the campaign.


Running it nightly​

A scheduled run keeps segments and campaigns in step without anyone clicking the button.

The package includes a template Flow called Segment Nightly Sync. It holds the placeholder field name REPLACE_WITH_YOUR_MULTISELECT_FIELD__c, so it does nothing useful until you copy it and point the copy at a real field.

  1. Open it in Setup > Flows and Save As a copy of your own.
  2. In the copy's Run Segment Sync step, set Segment Field API Name to your segment field and Account Contact Fields if you sync accounts.
  3. Set the schedule. The template runs daily at 07:00 UTC.
  4. Activate your copy.

It runs the same whole-org sync as the button. That step is the Sync Segments action. Your own Flows can also run it right after a job that sets segment values.

A blank field name does nothing and raises no error, so a copy left unset looks like it's working and changes nothing.


In a portal​

For staff who sign in to a portal instead of Salesforce, the picker also runs on a portal's record page as a segments card. Portal configuration has its keys. These things differ from Lightning:

  • The portal decides who can change segments. Only someone whose portal permission set lets them edit the field on that record can click the pills and gets Save, Add a new segment, and Sync to Campaigns. Everyone else sees the record's segments but can't change them.
  • Adding a segment is off unless the card turns it on. It needs the same Client Id and Client Secret as in Lightning. Without them, the person sees We couldn't add the new segment. An admin may need to finish setting up segments.
  • Sync to Campaigns is off unless the card turns it on. It runs the same whole-org sync and uses the card's own account contact fields.
  • The field has to be on the page's own object. A field one relationship away, such as Account.My_Segments__c, works only in Lightning.
  • A single-select picklist works, too. It holds one segment.

Things worth knowing​

  • Names are what tie them together. Rename a segment value or a campaign and they stop matching. Nothing warns you, and the two drift apart on the next run.
  • Keep campaign names unique. If two campaigns share a name, the oldest is used and the run says so in its notes.
  • Sync is never about one record. Every run syncs every record and campaign for that field.
  • Under Record Controls, deselecting a pill removes someone from a campaign. It's easy to do by accident while tidying up a record.
  • Adding an option changes your org. Everyone sees a new segment as soon as someone adds one, and removing it is a job for Setup.