You are here:
Adjust Order Item Summaries Submit Action
In Salesforce Order Management, adjust the price of one or more order product summaries on an order summary. You can only apply a discount, not an increase. This action creates one or more change order records.
Required Editions
| Available in: Lightning Experience |
| View supported editions. |
| This feature requires the Salesforce Order Management add-on. To purchase, contact your Salesforce account executive. |
In Flow Builder, add an Action element to your flow. Select the Order Management category, and search for Adjust Order Item Summaries Submit.
Set Input Values
Use values from earlier in the flow to set the inputs.
| Input Parameter | Description |
|---|---|
| Order Summary Id | ID of the order summary associated with the order product summaries that you want to adjust the prices of. |
| Adjust Order Product Summaries Input | This input is an Apex-defined variable of class ConnectApi.AdjustOrderItemSummaryInputRepresentation, which includes these fields:
|
Store Output Values
Use output values later in the flow. The values are assigned when the change orders are created.
| Output Parameter | Description |
|---|---|
| Adjust Order Product Summary Output | This output is an Apex-defined variable of class ConnectApi.AdjustOrderSummaryOutputRepresentation. Depending on the order product summaries included in the adjustment, one or more change orders are generated. If multiple change orders are generated, then the changeBalances values combine the values from both of them. The sign of a value in the changeBalances field is the opposite of the corresponding value on a change order record. For example, a discount is a positive value in changeBalances and a negative value on a change order record. The orderSummaryId field is the ID of the order summary specified in the input. The changeBalances field is an Apex-defined variable of class ConnectApi.ChangeItemOutputRepresentation, which includes these fields.
The postFulfillmentChangeOrderId is the ID of the change order representing the portion of the adjustment that was applied to order product summary quantities that have been fulfilled. The preFulfillmentChangeOrderId is the ID of the change order representing the portion of the adjustment that was applied to order product summary quantities that haven’t been fulfilled. If the input specified an allocatedItemsChangeOrderType of PreFulfillment, this change order also includes the changes applicable to order product summary quantities that are in the process of being fulfilled. The inFulfillmentChangeOrderId is the ID of the change order representing the portion of the adjustment that was applied to order product summary quantities that are in the process of being fulfilled. This change order is only created for an input that specified an allocatedItemsChangeOrderType of InFulfillment. |
Usage
When a price adjustment is applied to an order product summary, its quantities are considered in three groups:
- Pre-fulfillment—QuantityAvailableToFulfill, which is equal to QuantityOrdered - QuantityCanceled - QuantityAllocated
- In-fulfillment—QuantityAllocated - QuantityFulfilled
- Post-fulfillment—QuantityAvailableToReturn, which is equal to QuantityFulfilled - QuantityReturnInitiated
You can apply adjustments to these groups in three different ways, controlled by the allocatedItemsChangeOrderType input property:
- Distribute the adjustment evenly between pre-fulfillment and post-fulfillment quantities. Ignore in-fulfillment quantities. Create one change order for the adjustments to pre-fulfillment quantities and one change order for the adjustments to post-fulfillment quantities.
- Distribute the adjustment evenly between pre-fulfillment, in-fulfillment, and post-fulfillment quantities. Create one change order for the adjustments to both pre-fulfillment and in-fulfillment quantities, and one change order for the adjustments to post-fulfillment quantities.
- Distribute the adjustment evenly between pre-fulfillment, in-fulfillment, and post-fulfillment quantities. Create one change order for the adjustments to pre-fulfillment quantities, one change order for the adjustments to in-fulfillment quantities, and one change order for the adjustments to post-fulfillment quantities.
To set up the Adjust Order Product Summaries Input:
- Use Assignment elements to set the orderItemSummaryId, description, adjustmentType, discountValue, and reason field values on one or more ConnectApi.AdjustItemInputRepresentation variables.
- Use an Assignment element to add the ConnectApi.AdjustItemInputRepresentation variables to the changeItems field on a ConnectApi.AdjustOrderItemSummaryInputRepresentation variable.
- Use an Assignment element to set the allocatedItemsChangeOrderType field on the ConnectApi.AdjustOrderItemSummaryInputRepresentation variable.
- Use the ConnectApi.AdjustOrderItemSummaryInputRepresentation variable and the order summary ID in the action input.
In a flow for adjusting the prices of order product summaries, run an Adjust Order Item Summaries Preview action before running this action. Then display its output for the user to review. When the user verifies the expected results, pass the same input to this action.
After submitting a price adjustment, process refunds as appropriate:
- If the discount only applied to order product summaries for which payment hasn’t been captured, it doesn’t require a refund. This situation normally applies to order products in the US that haven’t been fulfilled.
- If the discount applied to order product summaries that haven’t been fulfilled and for which payment has been captured, process a refund. In this case, pass the totalExcessFundsAmount from changeBalances to the Ensure Refunds Async action.
- If the discount applied to order product summaries that have been fulfilled, process a refund. Pass the postFulfillmentChangeOrderId to the Create Credit Memo action, then pass the credit memo to the Ensure Refunds Async action.
- If the discount applied to both fulfilled and unfulfilled order product summaries for which payment has been captured, process both refunds. Pass the postFulfillmentChangeOrderId to the Create Credit Memo action, then pass the credit memo and the totalExcessFundsAmount from changeBalances to the Ensure Refunds Async action.
- An order with a total amount of $100 is placed, and the amount is captured immediately.
- A product is canceled from the order, resulting in $20 of excess funds.
- Before the excess funds are sent to the payment provider in an ensure refunds action, another product is canceled. This cancellation adds another $20 of excess funds. However, because the original $20 hasn’t been refunded yet, the cancel action returns a total excess funds amount of $40.
- The first excess funds amount ($20) is sent to the payment provider in an ensure refunds request.
- The second excess funds amount ($40) is sent to the payment provider in an ensure refunds request.
- The payment provider receives requests for $60 of refunds, when the correct refund total is $40. Because the total refund amount is less than the total captured amount of $100, the payment provider issues $60 in refunds.

