Hey ERPNEXT Fans,
I have one custom field and i would like to store and show the data in different pattern.
I am from Supply Chain Industry. For air transport, airlines issue an AWB number.
AWB number consist of 11 Digit. Usually its shown in below pattern.
eg. 607-22894152
First 3 digits are Airline Prefix, its assigned to one specific airline worldwide (It represents the airline name).
Next 7 digits are the sr. number of AWB.
Last 1 digit is a check digit which validates the AWB number (correct / incorrect).
Formula to calculate the check digit is here https://en.wikipedia.org/wiki/Air_waybill
My Requirements:
I have made a custom field “MAWB#” (type:int) and i want user to put the MAWB number in this. Once user put this number in to field (regardless of pattern xxx-xxxxxxxx or xxxxxxxxxxx), script should validate if this is the correct AWB number and store/show in the given pattern (xxx-xxxxxxxx). If the MAWB number is incorrect, it should throw an error that MAWB number is incorrect.
Upon successful validation, it should populate the “Airline name” in the next custom field “Airline name” (field type: You suggest) automatically (without saving the docs)
Let me know how to achieve this.