0

The new Winter 26 release of Salesforce is in my sandbox. I wrote code that will recalculate tax and apply the difference to each OrderItemSummary line, using "Flow Core Action for Order Management: Adjust Order Item Summaries Submit" as my core action. Winter 26/version 65 allows us to create a tax adjustment only, with the line "AmountTaxOnly."

My flow runs two paths: this path is Run Immediately, then I have another path that runs to commit the transaction to Avalara using Run Asynchronously.

This worked exactly one time this morning, and the result of my class was this:

{
  "changeBalances": {
    "grandTotalAmount": 38.5,
    "totalAdjDeliveryAmtWithTax": 0,
    "totalAdjDistAmountWithTax": 0,
    "totalAdjProductAmtWithTax": 38.5,
    "totalAdjustedDeliveryAmount": 0,
    "totalAdjustedDeliveryTaxAmount": 0,
    "totalAdjustedProductAmount": 0,
    "totalAdjustedProductTaxAmount": 38.5,
    "totalAdjustmentDistributedAmount": 0,
    "totalAdjustmentDistributedTaxAmount": 0,
    "totalAmount": 0,
    "totalExcessFundsAmount": 0,
    "totalFeeAmount": 0,
    "totalFeeTaxAmount": 0,
    "totalRefundableAmount": 0,
    "totalRequiredFundsAmount": 0,
    "totalTaxAmount": 38.5
  },
  "errors": [],
  "inFulfillmentChangeOrderId": null,
  "orderSummaryId": "1OsVB000001wDcD0AU",
  "postFulfillmentChangeOrderId": null,
  "preFulfillmentChangeOrderId": "801VB00000ZwoOWYAZ",
  "success": true
}

This is a record-triggered flow upon OrderSummary creation. Whenever I run it after this first time, I get an error message. Even though the flow I'm calling this from is version 65, and the custom apex class that I use to calculate the ConnectApi.AdjustOrderItemSummaryInputRepresentation input is using version 65, this message appears:

Error element Adjust_Order_Item_Summaries (FlowActionCall). Method invoked in version 48.0. Minimum required version for 'adjustItems' usage is: 49.0

It will happen if I'm in debug mode as well. How do I correct this? Why would the version not match the flow?

2
  • 1
    Apex classes have a specific API version they run against. Check to see what this is for the Apex you are calling. If you can, update that version. If the Apex is in a managed package and you can't update it, you may need to write your own invocable method with a recent API version that calls through to the managed package code. Commented Sep 22 at 15:16
  • Thanks, that worked. The Core Action was using Salesforce API version 48 with the AVAMAPPER connector. After creating an invocable apex class that used the underlying method ConnectApi.OrderSummary.adjustSubmit(OrderSummaryId, ConnectApi.AdjustOrderItemSummaryInputRepresentation) to circumvent the Core Action, it runs without issue. Commented Sep 23 at 17:48

1 Answer 1

1

Per comment suggestion, I was able to call the underlying method used in the Core Action to circumvent the API version that the managed package was using. I set my apex class to version 65 and then used "ConnectApi.OrderSummary.adjustSubmit(OrderSummaryId, ConnectApi.AdjustOrderItemSummaryInputRepresentation)" to submit the adjustment from the prior apex class. Works fine now.

Abstracted:

public class OrderSummarySubmitAdjustment {
    @InvocableMethod(label='Submit Order Adjustment' description='Submits order adjustment.')
    public static void submitOrderAdjustment(List<FlowInput> inputs) {
                
        for (FlowInput input : inputs)
        {
            ConnectApi.AdjustOrderSummaryOutputRepresentation adjustOutput = ConnectApi.OrderSummary.adjustSubmit(input.orderSummaryId, input.adjustInput);
        }
    }
    
    public class FlowInput {
        @InvocableVariable(label='Order Summary ID')
        public Id orderSummaryId;
        
        @InvocableVariable(label='Adjustment Input')
        public ConnectApi.AdjustOrderItemSummaryInputRepresentation adjustInput;
    }
}

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.