Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
ccrz.cc_api_DeliveryDate.getDeliveryDates
Compatibility
This reference applies to:
Release | Managed Package Version | API Version |
---|---|---|
B2B Commerce for Visualforce Winter ’21 | 4.13 | 12 |
B2B Commerce for Visualforce Spring ’20 | 4.12 | 11 |
B2B Commerce for Visualforce Summer ’19 | 4.11 | 10 |
B2B Commerce for Visualforce Spring ’19 | 4.10 | 9 |
B2B Commerce for Visualforce Summer ’18 | 4.9 | 8 |
Signature
global virtual Map<String, Object> getDeliveryDates(ID, String, ccrz.cc_bean_MockContactAddress)
Inputs (Required)
Map<String, Object> that can include the following keys:
- ccrz.cc_api_DeliveryDate.ACCOUNT_ID
- ID of the account record used for checkout.
- ccrz.cc_api_DeliveryDate.CART_ID
- String that specifies the ID of the cart record used for checkout.
- ccrz.cc_api_DeliveryDate.SHIP_ADDRESS
- ccrz.cc_bean_MockContactAddress that represents the shipping address selected for checkout.
Outputs
Map<String, Object> that can include the following keys:
- ccrz.cc_api_DeliveryDate.API_ERROR
- Boolean
Value Usage true An error occurred when constructing the delivery date data. When this key is true and the Validate Delivery Date setting of the Shipping Options storefront configuration is also true, the checkout flow doesn't continue. false (default) The method returned the delivery date data successfully. - ccrz.cc_api_DeliveryDate.DURATION
- Integer that specifies the number of days, after the offset value, when dates are no longer selectable in the date picker widget. For example, a duration value of 365 specifies that the final selectable date is one year after the first selectable date.
- ccrz.cc_api_DeliveryDate.EXCLUDED_DATES
- List<String> of values for the disabled_dates parameter of the zebra_datepicker.js library. This list specifies dates that you want to disable in the date picker widget. Each date uses the format dd MM yyyy, such as 31 12 2020.
- ccrz.cc_api_DeliveryDate.INCLUDED_DATES
- List<String> of values for the enabled_dates parameter of the zebra_datepicker.js library. This list specifies dates that you want to enable in the date picker widget. Each date uses the format dd MM yyyy, such as 31 12 2020.
- ccrz.cc_api_DeliveryDate.MESSAGES
- List<ccrz.cc_bean_Message> of messages to show to the buyer.
- ccrz.cc_api_DeliveryDate.OFFSET
- Integer that specifies the number of days from today until the first selectable date in the date picker widget. For example, an offset value of 1 specifies that the first selectable date is tomorrow.
The managed package also defines the following keys, but doesn't use them for returning any data:
- ccrz.cc_api_DeliveryDate.DAYS_FILTER
- ccrz.cc_api_DeliveryDate.MAX_DATE
- ccrz.cc_api_DeliveryDate.MIN_DATE
Examples
Allow a buyer to select only Monday, Wednesday, or Friday for a delivery date. The range begins tomorrow, and is available for one year.
global class cc_example_api_DeliveryDateMWF extends ccrz.cc_api_DeliveryDate{
global override Map<String, Object> getDeliveryDates(Map<String, Object> deliveryDatesInputData) {
return new Map<String, Object> {
ccrz.cc_api_DeliveryDate.OFFSET => 1,
ccrz.cc_api_DeliveryDate.DURATION => 365,
ccrz.cc_api_DeliveryDate.INCLUDED_DATES => new List<String>{'* * * 1,3,5'}
};
}
}
Allow a buyer to select any weekday for a delivery date. The range begins the day after tomorrow, and is available for 90 days.
global class cc_example_api_DeliveryDateWeekdays extends ccrz.cc_apiDeliveryDate{
global override Map<String, Object> getDeliveryDates(Map<String, Object> deliveryDatesInputData) {
return new Map<String, Object> {
ccrz.cc_api_DeliveryDate.OFFSET => 2,
ccrz.cc_api_DeliveryDate.DURATION => 90,
ccrz.cc_api_DeliveryDate.EXCLUDED_DATES => new List<String>{'* * * 0,6'}
};
}
}