Create Product Schedules
Establish or reestablish a product schedule with multiple installments for an
opportunity product. This resource is available in REST API version 43.0 and later. In API version
46.0 and later, established and re-established schedules support custom fields, validation rules,
and Apex triggers.
Syntax
URI: /services/data/vXX.X/sobjects/OpportunityLineItem/OpportunityLineItemId/OpportunityLineItemSchedules
Formats: JSON, XML
HTTP methods: PUT
Authentication: Authorization: Bearer token
Request parameters
| Parameter | Description |
|---|---|
| type | The type of the schedule. Required when establishing OpportunityLineItemSchedules. Valid values include Quantity, Revenue, or Both. |
| quantity | The total number of units to be repeated or divided in a quantity schedule. Must be an integer other than 0. |
| quantityScheduleType | The type of the quantity schedule, if the product has one. Valid values are Divide or Repeat. |
| quantityScheduleInstallmentPeriod | If the product has a quantity schedule, the amount of time covered by the schedule. Valid values are Daily, Weekly, Monthly, Quarterly, or Yearly. |
| quantityScheduleInstallmentsNumber | If the product has a quantity schedule, the number of installments. Can be an integer from 1 to 150. |
| quantityScheduleStartDate | The date the quantity schedule starts. Format is YYYY-MM-DD. |
| revenue | The amount of revenue to be repeated or divided. |
| revenueScheduleType | The type of the revenue schedule, if the product has one. Valid values are Divide or Repeat. |
| revenueScheduleInstallmentPeriod | If the product has a revenue schedule, the amount of time covered by the schedule. Valid values are Daily, Weekly, Monthly, Quarterly, or Yearly. |
| revenueScheduleInstallmentsNumber | If the product has a revenue schedule, the number of installments. Can be an integer from 1 to 150. |
| revenueScheduleStartDate | The date the revenue schedule starts. Format is YYYY-MM-DD. |
Examples
Establish both quantity and revenue schedules for an opportunity product.
1curl https://MyDomainName.my.salesforce.com/services/data/v67.0/sobjects/OpportunityLineItem/00kR0000001WJJAIA4/OpportunityLineItemSchedules -H "Authorization: Bearer token"JSON Request body
1{
2"type": "Both",
3"quantity": 100,
4"quantityScheduleType": "Repeat",
5"quantityScheduleInstallmentPeriod": "Monthly",
6"quantityScheduleInstallmentsNumber": 12,
7"quantityScheduleStartDate": "2018-09-15",
8"revenue": 100,
9"revenueScheduleType": "Repeat",
10"revenueScheduleInstallmentPeriod": "Monthly",
11"revenueScheduleInstallmentsNumber": 12,
12"revenueScheduleStartDate": "2018-09-15"
13}Establish a revenue schedule only for an opportunity product.
1curl https://MyDomainName.my.salesforce.com/services/data/v67.0/sobjects/OpportunityLineItem/00kR0000001WJJAIA4/OpportunityLineItemSchedules -H "Authorization: Bearer token"JSON Request body
1{
2"type": “Revenue”,
3"revenue": 100,
4"revenueScheduleType": “Divide”,
5"revenueScheduleInstallmentPeriod": “Quarterly”,
6"revenueScheduleInstallmentsNumber": 10,
7"revenueScheduleStartDate": "2018-09-15"
8}Establish a quantity schedule only for an opportunity product.
1curl https://MyDomainName.my.salesforce.com/services/data/v67.0/sobjects/OpportunityLineItem/00kR0000001WJJAIA4/OpportunityLineItemSchedules -H "Authorization: Bearer token"JSON Request body
1{
2"type": “Quantity”,
3"quantity": 10,
4"quantityScheduleType": "Repeat",
5"quantityScheduleInstallmentPeriod": “Daily”,
6"quantityScheduleInstallmentsNumber": 150,
7"quantityScheduleStartDate": "2020-09-15",
8}