AnsweredAssumed Answered

What happened to toFixed()?

Question asked by ChipAlexander420 on Dec 5, 2012
Latest reply on Dec 6, 2012 by ChipAlexander420
One of my processes just started throwing an error on the Javascript toFixed() function.  It was working fine until about half an hour ago - has something changed?

What I'm trying to do is convert a string to a number with 2 decimal places.  If there's a better way, please let me know.

Here's how I'm using it in a custom script:

if (pay_basis == "A-Annual") {
   hourly_rate = (pay_basis_amt/(hours_per_pp*26));
} else if (pay_basis == "H-Hourly") {
   hourly_rate = pay_basis_amt;
}

if (pay_basis = "A-Annual") {
   per_pp_amt = (pay_basis_amt/26);
} else if (pay_basis == "H-Hourly") {
   hourly_rate = pay_basis_amt*hours_per_pp;
}

if (hourly_rate <= 99.99) {
   rate_code = "4";
   base_rate = hourly_rate.toFixed(2)* 10000;
} else if (per_pp_amt <= 9999.99) {
   rate_code = "2";
   base_rate = per_pp_amt.toFixed(2) * 10000;
} else if (per_pp_amt > 9999.99) {
   rate_code = "E";
   base_rate = per_pp_amt.toFixed(2) * 10000;
}

Here's the error I get:
     Test execution of EC to Ceridian completed with errors. Embedded message: First document failure: [Function: Scripting]: Error executing custom script: sun.org.mozilla.javascript.internal.EcmaError: TypeError: Cannot find function toFixed. (#17); Caused by: sun.org.mozilla.javascript.internal.EcmaError: TypeError: Cannot find function toFixed. (#17); Caused by: TypeError: Cannot find function toFixed. (#17)

Outcomes