AnsweredAssumed Answered

JavaScript Error executing custom script: sun.org.mozilla.javascript.internal.EcmaError

Question asked by srkumar035547 on Nov 24, 2016
Latest reply on Nov 25, 2016 by mark.wesley.c.ancog613142

I'm using the JavaScript to get the Date which is like below code ......The code that created is working fine in other platform tested the code but in Boomi i'm getting the error ......
var days = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
var weekday = new Array(7);
weekday[0]= "Sunday";
weekday[1] = "Monday";
weekday[2] = "Tuesday";
weekday[3] = "Wednesday";
weekday[4] = "Thursday";
weekday[5] = "Friday";
weekday[6] = "Saturday";
var invoiceDatee = new Date(InvoiceDate);
var day = weekday[ invoiceDatee.getDay() ];
switch(day)
{
case "Sunday":
invoiceDatee.setDate(invoiceDatee.getDate() + 3);
break;
case "Monday":
invoiceDatee.setDate(invoiceDatee.getDate() + 3);
break;
case "Tuesday":
invoiceDatee.setDate(invoiceDatee.getDate() + 3);
break;
case "Wednesday":
invoiceDatee.setDate(invoiceDatee.getDate() + 5);
break;
case "Thursday":
invoiceDatee.setDate(invoiceDatee.getDate() + 5);
break;
case "Friday":
invoiceDatee.setDate(invoiceDatee.getDate() + 5);
break;
case "Saturday":
invoiceDatee.setDate(invoiceDatee.getDate() + 4);
break;
default:
}
var ScheduledDeliveryDate= invoiceDatee.toISOString().slice(0,10);

 

 

In Mapping i will  get the date from Document-cache and  i will pass the date to the Script-function it will add the required date....but i'm getting the error like below.
 

 

Test execution of xxxx Process completed with errors. Embedded message: [Function: Working Dates Map Function, Scripting (Step 2)]: Error executing custom script: sun.org.mozilla.javascript.internal.EcmaError: RangeError: Date is invalid. (#37) in at line number 37; Caused by: sun.org.mozilla.javascript.internal.EcmaError: RangeError: Date is invalid. (#37) in at line number 37; Caused by: RangeError: Date is invalid. (#37)

 

Can any help me with this..

 

Thanks

Attachments

Outcomes