I have the below html code in suitelet script
var html = ''
html += '<!DOCTYPE html>'
html += '<html>'
html += '<head>'
html += '<link href="
https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">'
html += '<title>'
html += 'Attendance Sheet'
html += '</title>'
html += '<style type="text/css">'
html += '</style>'
html += '</head>'
html += '<body>'
html += '<div class="container">'
html += '<form method="post">'
html += '<table>'
html += '<tr>'
html += '<td>Name</td>'
html += '<td class="col-md-8">'
html += '<input type="text" readonly class="form-control-plaintext" id="name" name="name" value="' + crrUsrName + '">'
html += '</td>'
html += '</tr>'
html += '<tr>'
html += '<td>Date</td>'
html += '<td class="col-md-8">'
html += '<input type="date" class="form-control" id="date" name="date">'
html += '</td>'
html += '</tr>'
html += '<tr>'
html += '<td>Department</label>'
html += '<td class="col-md-8">'
html += '<select class="form-control" id="dept" name="dept">'
html += '<option selected>-- Choose Department --</option>'
for (var i = 0; i < dept.length; i++) {
html += '<option value=' + dept[i].value + '>' + dept[i].text + '</option>'
}
html += '</select>'
html += '</td>'
html += '</tr>'
html += '</table>'
html += '<br>'
html += '<button type="submit" class="btn btn-primary">Save</button>'
html += '</form>'
html += '</div>'
html += '</body>'
html += '</html>'
when i using post form to create record in netsuite
params = {
name: params['name'],
date: params['date'],
dept: params['dept']
};
var attendRec = record.create({
type: 'customrecord_az_svcs_attendance_sheet'
})
for (var fldName in params) {
if (params.hasOwnProperty(fldName)) {
var fldType = attendRec.getField({
fieldId: fldName
})
if (fldType.type === 'date') {
var dateFormatted = format.parse({
value: params[fldName],
type: format.Type.DATE
})
attendRec.setValue(fldName, new Date(dateFormatted))
}
else {
attendRec.setValue(fldName, params[fldName])
}
}
}
i faced issue called "invalid date"
can anyone help me