Trying to create a BPM to update the invchead.invoicecomment FROM the OrderHed.InvoiceComment every time the latter field updates.
Has anybody done this?
Thanks in advance.
Note, obviously in some cases, there will only be an order as the invoice won’t yet have been produced.
Decided to go down the ABL route but getting this error:
/* invoiceheader comment from salesorder header comments invoice tab data directive */
For each ttOrderHed where ttOrderHed.RowMod = ‘U’.
For each OrderHed fields ( OrderNum ) no-lock where ttOrderHed.Company = InvcHead.Company and ttOrderHed.OrderNum = InvcHead.OrderNum.
If InvcHead.InvoiceNum > ‘20’ Then Do:
/* Go to the sales order header and retrieve the comments in the header comments invoice tab */
Wouldn’t a BPM on the update method of the Sales Order be appropriate. Something like check if the order is invoiced (has an invoice number), RowMod is U and the Invoice comment has changed from any to any?
Not in front of any systems ATM to look in more detail.
got a bit further with this ABL as it doesn’t error, it validates successfully…however, it doesn’t fire:
FOR EACH ttInvcHead, FIRST OrderHed FIELD(Character01) WHERE OrderHed.Company = ttInvcHead.Company AND OrderHed.OrderNum = ttInvcHead.Ordernum NO-LOCK.
IF orderhed.invoicecomment <> " " THEN DO:
ASSIGN ttInvcHead.Character01 = OrderHed.InvoiceComment.
END.
END.
it seems to work but the refresh time of clicking save on the order is quite a while which concerns me i’ve got something wrong:
re-edited:
FOR EACH InvcHead, EACH OrderHed WHERE OrderHed.Company = InvcHead.Company AND OrderHed.OrderNum = InvcHead.Ordernum AND OrderHed.Company = Cur-comp AND OrderHed.OrderNum = OrderHed.OrderNum NO-LOCK.
IF orderhed.invoicecomment <> " " THEN DO:
ASSIGN InvcHead.Character01 = OrderHed.InvoiceComment.
END.
END.