Sales Order Header Level Hold using Extension
Summary:
Hi,
Looking for some help on groovy script to apply Sales order Header HOLD.
I see the below script, but that is to apply at Line level. Appreciate if someone can share HEADER level HOLD code. Thank you!
************************************************************************************
def lines = header.getAttribute("Lines");
while (lines.hasNext()) {
def line = lines.next();
// Make sure the ordered quantity is greater than 10.
BigDecimal qty = line.getAttribute("OrderedQuantity");
if (qty.compareTo(new BigDecimal(10)) > 0) {
if (canApplyHold(line, "DOO_RSRV")) {
debug("Applying hold");
def hold = line.applyHold("DOO_RSRV"); // Create a hold and use the DOO_RSRV hold code.
// Display text that explains what we're doing.
hold.setAttribute("HoldComments", "We're holding this line so we can manually review and approve it.");
Tagged:
0