Newer Version Available
PriceAdjustmentSchedule
Supported Calls
create(), delete(), describeLayout(), describeSObjects(), getDeleted(), getUpdated(), query(), retrieve(), search(), undelete(), update(), upsert()
Special Access Rules
This object is available when the B2B Commerce license is enabled or when Subscription Management is enabled.
Fields
| Field | Details |
|---|---|
| AdjustmentMethod |
|
| Description |
|
| IsActive |
|
| LastReferencedDate |
|
| LastViewedDate |
|
| Name |
|
| OwnerId |
|
| ScheduleType |
|
Usage
When you create a PriceAdjustmentSchedule, you associate PriceAdjustmentTiers with it. A PriceAdjustmentSchedule is inactive until at least one PriceAdjustmentTier is added to it. A PriceAdjustmentSchedule comprises all related PriceAdjustmentTiers, with a maximum limit of 25 PriceAdjustmentTiers.
To use PriceAdjustmentSchedule, associate it with a PriceBookEntry.
- You can associate a PriceBookEntry with up to five PriceAdjustmentSchedules, but only one PriceAdjustmentSchedule can be associated with a PriceBookEntry.
- When you activate or deactivate a PriceAdjustmentSchedule, its PriceBookEntry association is also activated or deactivated.
- An adjustment to a PriceBookEntry is applied only if the associated PriceAdjustmentSchedule is active.
- After a PriceAdjustmentSchedule is associated with a PriceBookEntry, if multicurrency is enabled, the currencyIsoCode field can’t be modified.
- When you associate a PriceAdjustmentSchedule with a PricebookEntry, a junction object PricebookEntryAdjustment is created.
You can modify the PriceAdjustmentTier object, and the ScheduleType and AdjustmentMethod fields, only when a PriceAdjustmentSchedule is inactive.
Code Sample
1public void priceAdjustmentScheduleSample()
2 {try
3 /* This code snippet will do the following:
4 *
5 * 1. Create a new Price Adjustment Schedule
6 * 2. Create and attach a Price Adjustment Tier to the Schedule
7 * 3. Activate the Schedule
8 * 4. Create a new PricebookEntry Adjustment. This will associate the Schedule to a Pricebook Entry. */
9
10 //Create a Price Adjustment Schedule
11 PriceAdjustmentSchedule pas = new PriceAdjustmentSchedule();
12 pas.Name = 'Sample PAS';
13 pas.Description = 'Sample Price Adjustment Schedule';
14 pas.AdjustmentMethod = 'Range';
15 insert pas;
16
17 //Attach a valid Price Adjustment Tier
18 PriceAdjustmentTier pat = new PriceAdjustmentTier();
19 pat.PriceAdjustmentScheduleId = pas.Id;
20 pat.LowerBound = 1.0;
21 pat.UpperBound = 100.0;
22 pat.TierType = 'AdjustmentPercentage';
23 pat.TierValue = 5.0;
24 insert pat;
25
26 //Activate the Schedule
27 pas.IsActive = true;
28 upsert pas;
29
30 //Create a new PricebookEntry Adjustment
31 PricebookEntryAdjustment pbea = new PricebookEntryAdjustment();
32 pbea.PricebookEntryId = '01uRM0000007Hb5YAE';
33 pbea.PriceAdjustmentScheduleId = pas.Id;
34 insert pbea;
35
36 } catch (ConnectionException ce) {
37 ce.printStackTrace();
38 }
39}