MDQ – Amendment Ordering – Error: Can’t activate an order with partially segmented order items

If you’re here, you probably are trying to activate an Order against an amendment on a Quote that has MDQ lines. Did I get that right? 🙂 There’s an existing bug report that has not been addressed yet at Salesforce…

And you may have also come across this article explaining a work around by @Kyle Trebotich. If you haven’t checked his profile out, definitely do so. Quite a great CPQ powerhouse.

His work around is to null out the three Segment fields on all the order lines and THEN clicking activate. This is great! But… what about all of the existing orders that have already been created? Do I have to manually do this every time I want to order against an MDQ amendment? NOPE! Below is a solution to get your existing orders ready for activation as well as a solution for future orders so you don’t have to think about this anymore. 👍🏻

The fields we are concerned with are on the OrderItem object.

New Field – Order Object

To support the below solution, you’ll need to create a custom field for Quote Type on the Order object. This will tell us if a given Order is the result of an Amendment Quote.

General One Order – Autolaunched Flow

First, we need a flow that handles one Order! Here are the steps the flow takes:

  1. Autolaunched flow: Input is an Order ID.
  2. Retrieve the Order using Order ID and criteria is amendment Quote and not Activated.
  3. Create “Lines to Update” record set.
  4. If we have an Order,
    1. Get lines for this Order that has Segment fields filled in.
    2. Loop through the lines.
      1. Blank out Segment fields.
      2. Add this line to the “Lines to Update” record set.
  5. Return the “Lines to Update” record set.

Existing in-flight Orders – Manual Update

Once we have this invocable flow, we can make a flow to query all non-Activated Orders and update them.

  1. Invocable flow: no input.
  2. Retrieve all non-Activated Orders against amendment Quotes.
  3. Create “Lines to Update” record set.
  4. Loop through the Orders.
    1. Call above invocable flow.
    2. Set the output of the above flow to the “Lines to Update” record set.
  5. If we have Lines to Update,
    1. Update the lines.

Now, we have a flow to update all in-flight non-Activated Orders to blank out the Segment fields of the MDQ OrderItems. We need to call it. You can just run the flow from the flow designer. 👍🏻

Future Orders – Amendment Screen Flow

Now, for future Orders, we need a flow that triggers off a new “Amend” button for the Contract.

Here’s the flow:

  1. Screen Flow: Input: recordId
  2. Show screen to input Amendment Start Date value.
  3. Next Button
  4. Update Contract record.
  5. Forward to CPQ Amend screen.

Here is the button (Lightning Action): Make sure to add the below Action to your Lightning Page!

Installer

You’ve reached the end so, as always, here is an installer for all the things above. 🙂 Make sure to add the Action to your Lightning Page!

Sandbox | Production

4 thoughts on “MDQ – Amendment Ordering – Error: Can’t activate an order with partially segmented order items

  1. How does this work with multiple amendments and contracting? For example, I have a customer with 100 quantity year 1, 200 year 2, 300 year 3. They want to go up to 225 quantity for year 2. We amend, increase just that line, and with your logic it should contract. Say, later on, they want to go up to 250 quantity for year 2. When we amend for a second time, will the year 2 line show the correct 225 total or will it be separate lines?

    1. Hello there Margaret! The year 2 line will show the correct 225 total. You will have multiple Subscriptions on the current Contract but they will all get consolidated in the renewal.

      1. I am still getting the same error message and can’t activate the order when I have amendment it. I am trying to amend a multiyear where the second and third year will go up in quantity

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.