It can be helpful to have a quick overview of whether a BP has exceeded its credit limit.
In this sample, we'll show one way to make this information easily available by coloring the text in the BP Account Balance field based on the Credit Limit.
To achieve this, we'll need two B1 Validations and a Universal Function.
Universal Function
First, we'll set up the Universal Function to change the Forecolor of the Account Balance field based on our requirements.
The Universal Function checks whether the Credit Limit field has a value above 0, and whether the OCRD.Balance field exceeds this limit - in which case we color the field red.
In all other cases, we color the field green.
It's worth noting that the Universal Function contains all of the complex logic - this is done to avoid having the same logic in both of the B1 Validations we will be creating next.
You can copy the code from the box below.
IF($[$85.0.NUMBER] > 0 AND $[OCRD.Balance]>=$[$85.0.NUMBER])
BEGIN ForeColor($[$26.0.0]|RED);
END
ELSE
BEGIN ForeColor($[$26.0.0]|GREEN);
END
B1 Validation on Data Load
Then, we'll set up a B1 Validation for the BP form on Data Load to ensure that the field is properly colored whenever data is loaded for viewing.
You might notice that the validation does not have any complex logic, but simply calls our Universal Function.
Since we decided to place the complex logic on our Universal Function, both of our validations will simply be executing the Universal Function.
B1 Validation on Validate
Lastly, we'll set up a second B1 Validation, which calls the same Universal Function, to ensure that the coloring is updated whenever the Credit Limit field is changed.
Comments
0 comments
Please sign in to leave a comment.