Code to deduct values between field

Hi All,

My company would like to roll out customer loyalty program…a part of tasks will be make use our current Nav 5.0 (with LS-Retail POS 5.0) to accumulate customer’s purchase amount ($1 = 1 points). Currently we are using this already as my predecessor had written some Reports to accumulate the transactions and to holding the points and change them to VIP or Premember (with 6 months $5000 purchase can be VIP rule).

My new request will now be how to make Nav to deduct points and make it much dynamic (to switch the points exchange mechanism to whatever $1 = x points). As am very working in Nav with my low-end experiences, not a programmer, but I am thinking to make an additional field to hold the points to be deducting (based on customer’s how many points they want to deduct) in the Customer table, since my predecessor had created and we are using a field called “Points” to represent the points that customer has.

I tried to add additional fields in Customer table and try to make some code in that new field ( i just on validate and on lookup) but don’t know how… etc below requirements. Or you could advise a better method using codeunit?

If customer.“to deduct points” <> 0 Then, customer.“points” deduct “to deduct points” value.

then I have to ask the cashier to update a customer form and this will trigger to input the “to deduct point” value to perform the above.

I know this solution is very manual as I cannot figure out the way to make use of LS-Retail POS Loyalty scheme function, cos we don’t have maintenance with vendors for a long time.

Thank you!


Hi Patrick,
A simple solution could be to build your update into a batch (processing only) report that would calculate this field.
Eventually add a field to your customer ledger entry table (best table to use if you are not differentiating the calculation on the item no.'s) to mark if the sales invoices or credit memo’s has been included in your calculation or not. You update this field to yes, when you run your report.
It’s very easy, if you have a little NAV development experience.

Thank Erik, it’s great to receive your reply, as I saw your numbers of posts previously and you should be the number 1 posted most!!!

So, from your suggestion, is that I need to create a report to link up Customer Ledger Entry, Customer table (which has the existing field to hold the points), and create a new field in the Customer Ledger Entry table and have the user to input the points (to be deducted)? I don’t understand how to mark sales invoices or credit memo part you said? As we used LS-Retail and all transactions from POS is stored a table called “Trans. Sales Entry”.