Newer Version Available
Audience
Represents the audience in a community. An audience consists of
different types of criteria, where the audience can be assigned and used for targeting in a
community.This type extends the Metadata
metadata type and inherits its fullName field.
File Suffix and Directory Location
Audience components have the suffix .audience and are stored in the audience folder.
Version
Audience components are available in API version 44.0 and later.
Special Access Rules
Metadata access for the Audience type is backed by the AudienceMetadata permission. This permission should be on by default for orgs that have Networks enabled.
Fields
| Field Name | Field Type | Description |
|---|---|---|
| audienceName | string | Required. The name of the audience. |
| container | string | Required. Can be either Network or Organization, to represent where this Audience is contained. |
| criterion | AudienceCriterion[] | List of criteria in an audience. |
| description | string | The description of the audience. |
| FormulaFilterType | FormulaFilterType | Indicates the audience’s formula type. Valid values are
|
AudienceCriterion
| Field Name | Field Type | Description |
|---|---|---|
| criterionValue | AudienceCriteriaValue | The value of the criterion. |
| operator | AudienceCriterionOperator(enumeration of type string) | The operator associated with this criterion. Valid values are:
|
| type | AudienceCriterionType(enumeration of type string) | Valid Values are:
|
AudienceCriteriaValue
- Only the city, country, and subdivision fields can be used when the value of the AudienceCriterion type field is GeoLocation.
- Only the domain field can be used when the value of the AudienceCriterion type field is Domain.
- Only the profile field can be used when the value of the AudienceCriterion type field is Profile.
- Only entityField, entityType and fieldValue can be used when the value of the AudienceCriterion type field is FieldBased.
| Field Name | Field Type | Description |
|---|---|---|
| city | string | Can only be used when AudienceCriterion type is GeoLocation. |
| country | string | Can only be used when AudienceCriterion type is GeoLocation. |
| domain | string | Can only be used when AudienceCriterion type is Domain. |
| entityField | string | Can only be used when AudienceCriterion type is FieldBased. |
| entityType | string | Can only be used when AudienceCriterion type is FieldBased. |
| fieldValue | string | Can only be used when AudienceCriterion type is FieldBased. |
| profile | string | Can only be used when AudienceCriterion type is Profile. |
| subdivision | string | Can only be used when AudienceCriterion type is GeoLocation. |
Declarative Metadata Sample Definition
The following is an example of an Audience component.
1<?xml version="1.0" encoding="UTF-8"?>
2<Audience xmlns="http://soap.sforce.com/2006/04/metadata">
3 <audienceName>Audience Metadata</audienceName>
4 <container>Customer</container>
5 <criterion>
6 <criterionValue>
7 <country>United States</country>
8 <subdivision>Nevada</subdivision>
9 </criterionValue>
10 <operator>Equal</operator>
11 <type>GeoLocation</type>
12 </criterion>
13 <criterion>
14 <criterionValue>
15 <profile>customer community user</profile>
16 </criterionValue>
17 <operator>Equal</operator>
18 <type>Profile</type>
19 </criterion>
20 <criterion>
21 <criterionValue>
22 <domain>mobile1.t.salesforce.com</domain>
23 </criterionValue>
24 <operator>Equal</operator>
25 <type>Domain</type>
26 </criterion>
27 <criterion>
28 <criterionValue>
29 <entityField>Manager.Profile.CreatedBy.Contact.MailingCountry</entityField>
30 <entityType>User</entityType>
31 <fieldValue>USA</fieldValue>
32 </criterionValue>
33 <operator>StartsWith</operator>
34 <type>FieldBased</type>
35 </criterion>
36 <criterion>
37 <criterionValue>
38 <entityField>RecordTypeId</entityField>
39 <entityType>CollaborationGroup</entityType>
40 <fieldValue>CollaborationGroup.Group_RT2</fieldValue>
41 </criterionValue>
42 <operator>Equal</operator>
43 <type>FieldBased</type>
44 </criterion>
45 <formulaFilterType>AllCriteriaMatch</formulaFilterType>
46</Audience>Usage
You can’t delete an audience using Metadata
API.