Atomicity in Zoho Creator?

Atomicity in Zoho Creator?

I need a unique "order number" for each new order. I use a form's field to keep track of the next "order number" and increment it. 

string WalkIn.OM.Orders.NewOrderNumber()
{
    g  =  Global  [ID != 0];
    temp = g.Next_Order_Num;
    g.Next_Order_Num = (g.Next_Order_Num  +  1);
    return temp.toString();
}


The problem is, when 2 orders are created within 3 seconds apart, they'd get the same order number. Is there anyway to guarantee atomicity for the function above?? What's the right way to implement something like this in Zoho?