> For the complete documentation index, see [llms.txt](https://help.openloyalty.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.openloyalty.io/integrations-and-data-exchange/custom-fields/setup-for-campaigns.md).

# Setup for Campaigns

Direct, Referral, Automation, Leaderboard, and Challenge campaigns each have their **own** Custom Fields schema — a field created for Direct campaigns doesn't appear on Automation campaigns, and vice versa. Set up each schema from **Custom Fields**, exactly as described in [Setting Up Custom Fields](broken://pages/fab9589035d3fde779766df6d224e52d26b136fa).

{% hint style="info" %}
Unlike Members, campaign-type modules don't support Subgroups — only simple fields (String, Number, Boolean, Date, Single select, Multi select).
{% endhint %}

***

### Entering values

* Every campaign wizard/editor (Direct, Referral, Automation, Leaderboard, Challenges) has a dedicated **Custom Fields** step. Required fields must be filled in before the campaign can be saved.
* The values entered are repeated in the wizard's **Summary** step for review before publishing.
* The **Single Campaign View** shows a Custom Fields section with the saved values, the same way member profiles do.

***

### Custom fields in webhooks

Custom field data for a campaign is included in that campaign's **created** and **updated** webhooks, using the same group → field structure as the member API response. This means downstream systems (e.g. Salesforce, a BI pipeline) receive the campaign's custom attributes without a separate lookup call.

***

### Via the API

The same read/write pattern used for members applies to campaigns: `customFields` in the campaign payload (`POST` adds, `PUT` replaces), plus a dedicated partial-update endpoint:

```http
PATCH /api/{storeCode}/custom-fields/campaign/{campaignId}
```

The body uses the group → field structure; a field sent as `null` clears it, groups omitted from the payload are left untouched, and an unknown group returns a `400` validation error.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.openloyalty.io/integrations-and-data-exchange/custom-fields/setup-for-campaigns.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
