I am new with ABL so please forgive me if I am missing something basic here.
I am attempting to create a BPM that pops up a warning box on on the order entry screen if there are open credit memos on the user account. Below is the code so far, but I am having trouble referencing the InvcHead table using fields not declared in the “find first” statement.
I suspect that I am doing something out of order. Any help would be greatly appreciated.
Your warning box is more of a notification box as it won’t stop the records from updating, but the syntax looks right if that’s what you’re going for! Keep in mind though that some characters will cause errors in the code if included within the InfoMsg (I believe commas are one example). Also, here’s one example if you want to include a field value in the message as well:
{lib\PublishInfoMsg.i &InfoMsg = “'The MtlPartNum field value is: ’ + PartMtl.MtlPartNum”}.
Thanks Dan and Kevin, both of your comments were helpful.
I think the overall intent of my BPM is to create a notice if there is a credit on the account. My IF statement, does not connect to a specific invoice. I am trying to create the info message if there is a credit memo on the account. I believe I need to have a BAQ that will sum the open invoices. I mocked up the query using SQL. Is it possible to write a query to aggergate the InvoiceHed data inside of the BPM?
I am doing a search for open credit memo. The CM will be open if it hasn’t been applied to a invoice. Goal here is for the sales team to be notified in sales order entry that there are open credit memos for a customer. They can thusly check and apply a credit memo before charging a credit card.
Just brainstorming here, so any (or all) of the following may not apply (or be flat out wrong) …
If a CM is entered without an invoice referenced, it’s considered open (InvHead.OpenInvoice is true). What sets the OpenInvoice field to false - when it’s applied to an order during order entry?
Just trying to figure out when you know the CM has been “used”.
I realized I hadn’t understood the goal of the OP, so I deleted the above post that went in a completely wrong direction.
Back on track … I don’t think you need any custom code at all
The BPM should be simply have the condition:
Number of rows in the Query is not less than 1
With the query containing:
ttOrderHed.Company = InvcHead.Company
AND ttOrderHed.CustNum = InvcHead.CustNum
AND InvcHead.CreditMemo = true
AND InvcHead.OpenInvoice = true
Instead of looking for invoices with a balance of less than 0
EDIT:
An additional test for InvcHead.OrderNumber = 0 would check to make sure the CM isn’t already applied to an invoice, and is just waiting to be posted.
I’ve never used E9 (we jumped straight from V8 to E10), So I don’t know exactly how BPM’s are made in E9. But I don’t think you need any custom code to do what you want. At least not until you want to make it fancier.
Back in V8, the “Designer” consisted of a table/list of condition(s) (the when to execute the actions), and another table/list of action(s) to take when the condition is met. And you had the option to use custom code for either.
To do what you want in V8, I’d just use one of the condition templates - the one highlighted below (the pict below is from E10, but I assume they’re pretty close)
You can change the message type by changing the severity
&InfoSeverity = {&MESSAGE_INFO}
&InfoSeverity = {&MESSAGE_WARN}
&InfoSeverity = {&MESSAGE_ERR}
&InfoSeverity = {&message_UpdateConflict}