applying hold on header level via OM Extension Script - error
Summary:
I have a simple OM Extension script that is applying hold on order header if a condition is met. I am invoking this extension script at the event "On End of Submission Request". The script is just doing this:
def holdResult = header.applyHold("XX_HOLD_SERVICEMAX_ORDER", "Apply Header Hold XX_HOLD_SERVICEMAX_ORDER through OM Extension");
def status = holdResult.getStatus();
def message = holdResult.getMessage();
if ("FAILURE".equals(status)) {
throw new ValidationException(message);
}
But when I submit this order, I am getting this error:
JBO-DOO:::DOO_EXT_POST_SUBMIT: <MESSAGE><NUMBER>DOO-2686157</NUMBER><TEXT>Order management extension AutoApply Hold for Order Header created from Debrief attempted to add a new order line to a sales order during the {EVENT} event.</TEXT><CAUSE></CAUSE><ACTION></ACTION><DETAILS>You can't use an order management extension to add a new order line to a sales order during the End of Submission event. Modify your extension so it doesn't add a new order line to a sales order during the End of Submission event.</DETAILS><INCIDENT></INCIDENT></MESSAGE>