Sales Order Over Credit Limit Warning with Boyum B1UP
The Boyum Stop-Sign example inspired two customizations that we use. One is to warn users when they choose a Business Partner on a Sales Order if the BP is over their credit limit. This modification shows the Customer # name and number as well as the Name and BP name in red. Create a validation on a sales order like this…
Name: SO Terms Customer Over Credit Limit – A
Formtype = 139
Item = 54
FormMode = All
Event = Got Focus
BeforeAction = False
ActionSuccess = True
ItemChanged = Ignore
InnerEvent = Ignore
BubbleEvent = Ignore
SQL Condition:
IF (SELECT Balance FROM OCRD WHERE CardCode = $[$4.0.0] AND
GroupNum <> -1 AND CardType = ‘C’ ) > (SELECT CreditLine FROM OCRD WHERE CardCode = $[$4.0.0])
BEGIN
SELECT ‘CustNum-In-Red’ FOR BROWSE
END
ELSE
BEGIN
SELECT ‘CustNum-In-Blk’ FOR BROWSE
END
Condition Result
CustNum-In-Red = (Function) SO-BPCLr
CustNum-In-Blk = (Function) SO-BPCLb
Create two functions. One displays red text, one displays black…
Function1
Code: SO-BPCLr
Name: SO BP Over Credit Limit – Red
Type: Macro
ForeColor($[$4.0.0]|Red);
ForeColor($[$5.0.0]|Red);
ForeColor($[$54.0.0]|Red);
ForeColor($[$55.0.0]|Red);
Function2
Code: SO-BPCLb
Name: SO BP Over Credit Limit – Black
Type: Macro
ForeColor($[$4.0.0]|Black);
ForeColor($[$5.0.0]|Black);
ForeColor($[$54.0.0]|Black);
ForeColor($[$55.0.0]|Black);
To make this work 100% of the time I had to add a nearly identical Validation. Only the things that are different are listed. So just duplicate the first validation and change the following…
Name: SO Terms Customer Over Credit Limit – B
Item = 4
Event = Lost Focus