Custom Auto Number Updates all previous numbers
I have a form Named "Shop_Tickets", with a sub form "Work_Orders".
The WO# field is the output of the following script on the sub form "On Add Row" work flow:
counter = "WO" + "-" + zoho.currentdate;
counter_num = 0;
counter_job = Jobs[ID == input.Job].Job_Number;
for each line in Work_Orders
{
counter_num = (counter_num + 1);
line.WO = ((((counter) + "-") + (counter_job)) + "-") + (counter_num);
}
which is producing exactly the results I want in the format I want, However the date is not staying persistent.
Example:
Monday 1/1/2015 - I add three WO's to the "Shop_Tickets" form of Job x
the wo#'s would be:
WO-1.1.15-51523-1
WO-1.1.15-51523-2
WO-1.1.15-51523-3
Tuesday 2.1.15 - I add one WO to the same " Shop_Tickets" form
WO-2.1.15-51523-4
which is the correct number and format, but it changes the numbers on all the previous tickets to:
WO-2.1.15-51523-1
WO-2.1.15-51523-2
WO-2.1.15-51523-3
so every time i add a row it is updating the current date, of that field in every row.
Am I just missing the way to prevent this?