The promotion campaign assignment search document contains a search object that allows filtering on various attributes.
The query attribute specifies a complex query that can be used to narrow down the search. Attributes are grouped into different buckets.
The following is a list of searchable attributes with their corresponding buckets:
main:
Attribute | Type |
---|---|
rank | Integer |
startDate | Date |
endDate | Date |
campaign:
Attribute | Type |
---|---|
campaign | String |
promotion:
Attribute | Type |
---|---|
promotionId | String |
description | String |
enabled | Boolean |
special handling:
Attribute | Type |
---|---|
couponId | String |
Only fields in the same bucket can be joined using a disjunction (or). For instance, when joining campaignId and rank, only a conjunction (and) is allowed, while promotionId and description can be joined using a disjunction because they are in the same bucket. Special handling fields must always use conjunctions. If the field is used in a disjunction that violates this rule, an exception is thrown.
Note that only searchable attributes can be used in sorting.
If you would like to get a raw Response object use the other assignmentsSearch function.
An object containing the options for this method.
A promise of type PromotionCampaignAssignmentSearchResult.
The promotion campaign assignment search document contains a search object that allows filtering on various attributes.
The query attribute specifies a complex query that can be used to narrow down the search. Attributes are grouped into different buckets.
The following is a list of searchable attributes with their corresponding buckets:
main:
Attribute | Type |
---|---|
rank | Integer |
startDate | Date |
endDate | Date |
campaign:
Attribute | Type |
---|---|
campaign | String |
promotion:
Attribute | Type |
---|---|
promotionId | String |
description | String |
enabled | Boolean |
special handling:
Attribute | Type |
---|---|
couponId | String |
Only fields in the same bucket can be joined using a disjunction (or). For instance, when joining campaignId and rank, only a conjunction (and) is allowed, while promotionId and description can be joined using a disjunction because they are in the same bucket. Special handling fields must always use conjunctions. If the field is used in a disjunction that violates this rule, an exception is thrown.
Note that only searchable attributes can be used in sorting.
An object containing the options for this method.
Set to true to return entire Response object instead of DTO.
A promise of type Response if rawResponse is true, a promise of type PromotionCampaignAssignmentSearchResult otherwise.
Generated using TypeDoc
Assignments
*# API Overview
Use the Assignments API to search for promotions associated with campaigns.
For more information, see Campaigns and Promotions in the Salesforce B2C Commerce Infocenter.
Authentication & Authorization
The client requesting the promotion information must have access to the Promotion resource. For resource access, you must use a client ID and client secret from Account Manager to request an access token. The access token is used as a bearer token and added to the Authorization header of your API request. The client must first authenticate against Account Manager to log in.
You must include the relevant scope(s) in the client ID used to generate the token. For details, see Authorization Scopes Catalog.
For detailed setup instructions, see Authorization for Admin APIs.
Use Cases
Find All Associated Promotions
Use the Assignments API to find all associated promotions for a given campaign. *
For instructions on how to retrieve access token for admin APIs: https://developer.salesforce.com/docs/commerce/commerce-api/guide/authorization-for-admin-apis.html
Example with admin auth
API Version: 1.4.4import { Assignments, ClientConfig } from "commerce-sdk"; // or const { Assignments, ClientConfig } = require("commerce-sdk"); const clientConfig: ClientConfig = { parameters: { clientId: "XXXXXX", organizationId: "XXXX", shortCode: "XXX", siteId: "XX" } }; token = { access_token: 'INSERT_ACCESS_TOKEN_HERE' }; clientConfig.headers['authorization'] = `Bearer ${token.access_token}`; const assignmentsClient = new Assignments(clientConfig);
Last Updated: