Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Numberedheadings

The Commitments API is implemented as Apex class and is exposed as REST web service by using Salesforce standard functionality (see Apex Developer Guide for more information). For general information about the dynamic pricing feature, see 4.16 Commitments. The Apply Commitments functionality finds and sets the matching conditions and applies the discounts from the matching Commitment Condition

REST web service

URL

https://<my-domain-name>.my.salesforce.com/services/apexrest/ADvendio/ADvendio__Campaign_Item__c/ApplyCommitments/

Method

PATCH

URL Params

Data Params

A JSON object with the attribute campaignItems, containing a JSON serialized list of Campaign Items.

Example: { "campaignItems":[{<Campaign Item>}, ...]}

Success Response

Code: 200

Content: A JSON serialized list of the Campaign Items from the request body, but now with updated discount and Commitment Condition fields.

Example: [{<Campaign Item>}, ...]

Error Response

See Salesforce Apex REST Documentation

Logic

Matching logic

A Commitment Condition matches if all criteria (Commitment Condition fields) match. If the Commitment Condition field is empty, it matches all Campaign Item values.

ADvendio__CommitmentCondition__c

ADvendio__Campaign_Item__c

Matching

ADvendio__AdvertisingMedium__c

ADvendio__Ad_price__r.ADvendio__Ad_Spec__r.ADvendio__Placement__r.ADvendio__Site__c

equals

ADvendio__MediaDifferentiation__c

ADvendio__Ad_price__r.ADvendio__Ad_Spec__r.ADvendio__Ad_Type__r.ADvendio__MediaDifferentiation__c

equals

ADvendio__MediaSegment__c

ADvendio__Ad_price__r.ADvendio__Ad_Spec__r.ADvendio__Placement__r.ADvendio__MediaSegment__c

equals

ADvendio__MediaType__c

ADvendio__Ad_price__r.ADvendio__Ad_Spec__r.ADvendio__Placement__r.ADvendio__Site__r.ADvendio__MediaType__c

equals

ADvendio__Unit__c

ADvendio__Ad_price__r.ADvendio__PriceUnit__c

equals

ADvendio__AdPrice__c

ADvendio__Ad_price__c

equals

ADvendio__AdSpec__c

ADvendio__Ad_price__r.ADvendio__Ad_Spec__c

equals

ADvendio__AdType__c

ADvendio__Ad_price__r.ADvendio__Ad_Spec__r.ADvendio__Ad_Type__c

equals

ADvendio__Placement__c

ADvendio__Ad_price__r.ADvendio__Ad_Spec__r.ADvendio__Placement__c

equals

ADvendio__Content__c

ADvendio__SelectedContents__r

contains

ADvendio__PageEquivalency__c

ADvendio__Ad_price__r.ADvendio__Ad_Spec__r.ADvendio__Ad_Type__r.ADvendio__PageEquivalency__c

equals

Required fields

  • ADvendio__Media_Campaign__r.ADvendio__Commitment__c,ADvendio__AgencyEarningCommitment__c,ADvendio__ThirdPartyCommitment__c or ADvendio__Media_Campaign__c

  • ADvendio__Ad_Price__c

Fields referenced by the Ad Price (Ad Spec, Ad Type, Placement, Site ...) are automatically queried if not set.

Fields set by ApplyCommitments method

Depending on the linked Commitments and the matching Commitment Condition the following fields will be written:

Rebate in Kind:

  • Quantity__c

  • Rate_Discount_4__c

  • Rate_Discount_4_Name__c

  • CommitmentRelevant__c

  • ConditionApplied__c

Special Discount:

  • Rate_Discount_4__c

  • Rate_Discount_4_Name__c

  • SpecialDiscountCondition__c

  • SpecialDiscountCondition__r

  • ConditionApplied__c

Scaled Discount:

  • Rate_Discount_4__c

  • Rate_Discount_3_custom__c

  • Rate_Discount_2_custom__c

  • SpecialDiscountCondition__c

  • Rate_Discount_4_Name__c

  • ScaledDiscountCondition__c

  • ScaledDiscountCondition__r

  • ConditionApplied__c

AgencyEarnings:

  • ADvendio__AgencyEarnings__c

  • ADvendio__AgencyEarningsCondition__c

  • ADvendio__AgencyEarningsCondition__r

Third Party Discount:

  • ThirdPartyCommissionCustom__c

  • TPCCondition__c

  • TPCCondition__r

  • ConditionApplied__c

Examples

Get a Session-ID

Get a Session ID
bash


Connected App

Get CLIENT_ID and CLIENT_SECRET from any connected app or create a new app in your org: App Manager -> New Connected App


Simple request

A simple request with a Commitment and Commitment Conditions matching the Campaign Item / Ad Price.

Call Dynamic Pricing web service
bash


requestBody.txt
js


Response
js


Usage in Apex