Promotion APIs for A/B Testing
You can use the Salesforce B2C Commerce APIs for when a promotion is assigned to an A/B test and not to a campaign. These classes return a placeholder campaign, representing A/B tests, for API methods that return or process a campaign instance, when an A/B test (not a campaign) is in effect.
- dw.campaign.Campaign
- dw.campaign.CampaignMgr
- dw.campaign.Promotion
- dw.campaign.PromotionMgr Note: Returned PromotionPlans don't contain multiple Promotion objects with the same ID.
- dw.campaign.PriceAdjustmentNote: A/B tests are just another case of a promotion without an associated campaign.
The method Promotion.getCampaign.getCustom isnβt accessible when a promotion is assigned to an A/B test and not a campaign. The method returns an empty map because this object isn't derived from an extensible object. The method promotions.campaign is a dummy object, which is an instance of dw/object/ExtensibleObject.java. When the method promotions.campaign.custom is called, the getCustom method on dw/object/ExtensibleObject.java is called and returns the βExtensibleObjectAttributes idβ value. When a promotion or price adjustment is the result of an A/B test, the method Promotion.getCampaign.getID() always returns AB Testing.
When a promotion or price adjustment is the result of an A/B test, these methods return the following:
With this method... | Returns... |
---|---|
Promotion.getCampaign | placeholder campaign |
Promotion.getCoupons | empty collection |
Promotion.getCustomerGroups | empty collection |
Promotion.getSourceCodeGroups | empty collection |
Promotion.isBasedOnCoupon | false |
Promotion.isBasedOnCoupons | false |
Promotion.isBasedOnCustomerGroups | false |
Promotion.isBasedOnSourceCodes | false |
PriceAdjustment.getCampaign | placeholder campaign |
PriceAdjustment.getCampaignID | ID of placeholder campaign |
PriceAdjustment.getCouponLineItem | null |
PriceAdjustment.isBasedOnCampaign | true |
PriceAdjustment.isBasedOnCoupon | false |