Calculate Account

Hi,
When I create a new customer, I need create automatically his account, with custumerId + 430, and I need complete with ‘0’ until de 9 digits account.
For example, a new customer with customerId = 350.
The result would be 430 000 350, I need to fill with zeros to the left of the customerId until the total of the string add to 9 digits

Thanks.

Hi Juan,

You can use the utils.stringLeft() function to pad the number with zeros.

var customerID = 350;
customerID = "430" + utils.stringLeft("000000000", 6 - String(customerID).length) + customerID;

Hope this helps.