Calculated Field - Days Between 2 Dates

Calculated Field - Days Between 2 Dates

Hello, I am working on a Field & Form Rule that will trigger an "Execute Script" command On Form Submit.

I have a custom date field called "Pending Initial Review".

I want the script to calculate the days between CREATEDATE and Pending Initial Review and place the integer value into a field called Pending Initial Review Days.

Here's what I have so far but I'm getting the following error "Please provide numeric value").

var date1 = 'CREATEDATE';
var PendingInitialReview = 'WorkOrder_Fields_UDF_DATE12';
var days = (PendingInitialReview-date1)/86400/1000;
var PendingInitialReviewDays='WorkOrder_Fields_UDF_LONG1';
$CS.setValue(PendingInitialReviewDays,days); 

Any help would be appreciated.

Thanks,
Adam.

                  New to ADSelfService Plus?