JC
11/12/2021, 4:42 PMvar arraydate = initdate.split("-")
any idea why? I've checked documentation on split() and being used properly. Also, this is only happening in SB and not in Production, we just refreshed so environments are pretty much the same.CD
11/12/2021, 4:43 PMinitdate
is undefined. Log it and seeJC
11/12/2021, 4:43 PMCD
11/12/2021, 4:44 PMinitdate
is set?JC
11/12/2021, 4:45 PMvar initdate = context["59"]
log.debug({
title: 'Date',
details: initdate
});
var arraydate = initdate.split("-")
JC
11/12/2021, 4:45 PMJC
11/12/2021, 4:45 PMCD
11/12/2021, 4:46 PMcontext
set?JC
11/12/2021, 4:53 PM**
*@NApiVersion 2.1
*@NScriptType Restlet
*/
// Script to handle incoming data from the website and create SQT opportunity based records
define(["N/record", "N/search"], function (record, search) {
// POST the record
function post(context) {
// Title Case
String.prototype.toProperCase = function () {
return this.replace(/\w\S*/g, function (txt) {
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
});
};
// Define the variables being captured
var days = context["57"];
var package = context["56"];
var firstname = context["19"];
var lastname = context["20"];
var email = context["2"];
var addressOne = context["58.1"];
var addressTwo = context["58.2"];
var city = context["58.3"];
var state = context["58.4"];
var zip = context["58.5"];
var county = context["58.6"];
var company = context["4"];
var phone = context["52"];
var notes = context["51"];
var leadsource = context["94"];
// Date time variables (Due date should be 3 days prior to start date)
var initdate = context["59"]
log.debug({
title: 'Date',
details: initdate
});
var arraydate = initdate.split("-")
var dateString = arraydate[1] + "/" + arraydate[2] + "/" + arraydate[0]
var duedate = new Date(dateString)
duedate.setDate(duedate.getDate() - 3)
var date = new Date(dateString)
eblackey
11/12/2021, 7:19 PM