Newer Version Available
Personalization Class
Namespace
Personalization Methods
createAudience(communityId, audience)
API Version
48.0
Requires Chatter
No
Signature
public static ConnectApi.Audience createAudience(String communityId, ConnectApi.AudienceInput audience)
Parameters
- communityId
- Type: String
- ID of the community.
- audience
- Type: ConnectApi.AudienceInput
- A ConnectApi.AudienceInput object that defines the audience.
Return Value
Type: ConnectApi.Audience
createTargets(communityId, target)
API Version
48.0
Requires Chatter
No
Signature
public static ConnectApi.TargetCollection createTargets(String communityId, ConnectApi.TargetCollectionInput target)
Parameters
- communityId
- Type: String
- ID of the community.
- target
- Type: ConnectApi.TargetCollectionInput
- A ConnectApi.TargetCollectionInput object that defines the targets.
Return Value
getAudience(communityId, audienceId, includeAudienceCriteria)
API Version
48.0
Available to Guest Users
48.0
Requires Chatter
No
Signature
public static ConnectApi.Audience getAudience(String communityId, String audienceId, Boolean includeAudienceCriteria)
Parameters
Return Value
Type: ConnectApi.Audience
getAudienceBatch(communityId, audienceIds)
API Version
48.0
Available to Guest Users
48.0
Requires Chatter
No
Signature
public static ConnectApi.BatchResult[] getAudienceBatch(String communityId, List<String> audienceIds)
Parameters
Return Value
Type: ConnectApi.BatchResult[]
The ConnectApi.BatchResult.getResult() method returns a ConnectApi.Audience object and errors for audiences that didn’t load.
getAudiences(communityId, ipAddress, domain, userId, publishStatus, includeAudienceCriteria, targetTypes)
API Version
48.0
Available to Guest Users
48.0
Requires Chatter
No
Signature
public static ConnectApi.AudienceCollection getAudiences(String communityId, String ipAddress, String domain, String userId, ConnectApi.PublishStatus publishStatus, Boolean includeAudienceCriteria, List<String> targetTypes)
Parameters
- communityId
- Type: String
- ID of the community.
- ipAddress
- Type: String
- IP address of the user. If null, no audiences with location criteria are returned.
- domain
- Type: String
- Name of the user’s Salesforce custom domain. If null, no audiences with domain criteria are returned.
- userId
- Type: String
- ID of the user. If null, defaults to the ID of the context user.
- publishStatus
- Type: ConnectApi.PublishStatus
- Publish status of the audience. Values are:
- Draft
- Live
- includeAudienceCriteria
- Type: Boolean
- Specifies whether to include audience criteria (true) or not (false). If unspecified, defaults to false.
- targetTypes
- Type: List<String>
- Comma-separated list of target types to filter the results. In version 48.0 and later, supported values include ExperienceVariation and custom object API names, such as CustomObjectName__c. If null, all target types are returned.
Return Value
getTarget(communityId, targetId)
API Version
48.0
Available to Guest Users
48.0
Requires Chatter
No
Signature
public static ConnectApi.Target getTarget(String communityId, String targetId)
Return Value
Type: ConnectApi.Target
getTargets(communityId, ipAddress, domain, userId, publishStatus, recordId, targetTypes, includeAudience, includeAllMatchingTargetsWithinGroup, groupNames)
API Version
48.0
Available to Guest Users
48.0
Requires Chatter
No
Signature
public static ConnectApi.TargetCollection getTargets(String communityId, String ipAddress, String domain, String userId, ConnectApi.PublishStatus publishStatus, String recordId, List<String> targetTypes, Boolean includeAudience, Boolean includeAllMatchingTargetsWithinGroup, List<String> groupNames)
Parameters
- communityId
- Type: String
- ID of the community.
- ipAddress
- Type: String
- IP address of the user. If null, no audiences with location criteria are returned.
- domain
- Type: String
- Name of the user’s Salesforce custom domain. If null, no audiences with domain criteria are returned.
- userId
- Type: String
- ID of the user. If null, the default is the ID of the context user.
- publishStatus
- Type: ConnectApi.PublishStatus
- Publish status of the target. Values are:
- Draft
- Live
- recordId
- Type: String
- ID of the record, if you want to specify field based criteria in audiences.
- targetTypes
- Type: List<String>
- Comma-separated list of target types to filter the results. In version 48.0 and later, supported values include ExperienceVariation and custom object API names, such as CustomObjectName__c. If null, all target types are returned.
- includeAudience
- Type: Boolean
- Specifies whether to include the matching audience (true) or not (false). If null, the default is false.
- includeAllMatchingTargetsWithinGroup
- Type: Boolean
- Specifies whether to include all the matching targets within a target group (true) or not (false). If null, the default is false. If false, the first matching target within each group, based on priority within the group, is returned.
- groupNames
- Type: List<String>
- A comma-separated list of group names. Groups bundle related target and audience pairs.
Return Value
updateAudience(communityId, audienceId, audience)
API Version
48.0
Requires Chatter
No
Signature
public static ConnectApi.Audience updateAudience(String communityId, String audienceId, ConnectApi.AudienceInput audience)
Parameters
- communityId
- Type: String
- ID of the community.
- audienceId
- Type: String
- ID of the audience.
- audience
- Type: ConnectApi.AudienceInput
- A ConnectApi.AudienceInput object that defines the updates to the audience.
Return Value
Type: ConnectApi.Audience
updateTargets(communityId, target)
API Version
48.0
Requires Chatter
No
Signature
public static ConnectApi.TargetCollection updateTargets(String communityId, ConnectApi.TargetCollectionUpdateInput target)
Parameters
- communityId
- Type: String
- ID of the community.
- target
- Type: ConnectApi.TargetCollectionUpdateInput
- A ConnectApi.TargetCollectionUpdateInput object that defines the updates for the targets.