Nicholas Williams
02/20/2024, 7:58 PMvar nyTime = format.format({
value:date,
type:format.Type.DATETIME,
timezone:format.Timezone.AMERICA_NEWYORK
});
record.submitFields({
type: 'customrecord_dc_wo',
id: wo,
values: {
custrecord_dc_wo_eq_lot_check_created: new Date(nyTime)
}
})erictgrubaugh
02/20/2024, 8:07 PMNicholas Williams
02/20/2024, 8:07 PMaerin
02/20/2024, 8:10 PMNicholas Williams
02/20/2024, 8:10 PMerictgrubaugh
02/20/2024, 8:11 PMnyTime outputs 08:40 as a string, then when you pass that through new Date() it assumes Pacificerictgrubaugh
02/20/2024, 8:11 PMNicholas Williams
02/20/2024, 8:11 PMNicholas Williams
02/20/2024, 8:12 PMnew Date()erictgrubaugh
02/20/2024, 8:13 PMdate as a string at all? If you just leave it as a Date instance (i.e. pass date as the value for the field), does this go away?Nicholas Williams
02/20/2024, 8:15 PMnew Date(date) you get an error:
ERROR String: {"type":"error.SuiteScriptError","name":"INVALID_FLD_VALUE","message":"You have entered an Invalid Field Value 02/08/2024 08:40 am for the following field: custrecord_dc_wo_eq_lot_check_created"erictgrubaugh
02/20/2024, 8:20 PMdate to be a Date instanceNicholas Williams
02/20/2024, 8:20 PMerictgrubaugh
02/20/2024, 8:21 PMtimezone s/b Pacific iso New Yorkerictgrubaugh
02/20/2024, 8:21 PMdate was already a Date, so I wasn't sure about the need for nyTime as a stringerictgrubaugh
02/20/2024, 8:23 PMdate is coming from, you probably don't need format.format at allNicholas Williams
02/20/2024, 8:25 PMaerin
02/20/2024, 8:29 PMerictgrubaugh
02/20/2024, 8:31 PM// Assuming the string:
date = "02/05/2024 8:40 am"
// I'm suggesting
record.submitFields({
type: 'customrecord_dc_wo',
id: wo,
values: {
custrecord_dc_wo_eq_lot_check_created: new Date(date)
}
})
The Date constructor will assume Pacific, and the SQL should be returning Pacific, so I'm not sure there's a need to do any conversionbattk
02/20/2024, 8:35 PMbattk
02/20/2024, 8:35 PMbattk
02/20/2024, 8:35 PMNicholas Williams
02/20/2024, 8:36 PMbattk
02/20/2024, 8:36 PMbattk
02/20/2024, 8:36 PMbattk
02/20/2024, 8:36 PMbattk
02/20/2024, 8:37 PMbattk
02/20/2024, 8:37 PMbattk
02/20/2024, 8:38 PMNicholas Williams
02/20/2024, 8:38 PMbattk
02/20/2024, 8:38 PMformat.format({
value:date,
type:format.Type.DATETIME,
timezone:format.Timezone.AMERICA_NEWYORK
});battk
02/20/2024, 8:38 PMbattk
02/20/2024, 8:39 PMbattk
02/20/2024, 8:39 PMbattk
02/20/2024, 8:39 PMbattk
02/20/2024, 8:40 PMbattk
02/20/2024, 8:40 PMbattk
02/20/2024, 8:40 PM02/05/2024 8:40 ambattk
02/20/2024, 8:40 PMnew Date(nyTime)battk
02/20/2024, 8:41 PMbattk
02/20/2024, 8:41 PMbattk
02/20/2024, 8:42 PMbattk
02/20/2024, 8:43 PMNicholas Williams
02/20/2024, 8:44 PM//DATE FROM SQL
var date = '02/05/2024 8:40 am';
var formattedDate = format.format({
value: date,
type: format.Type.DATETIME,
timezone: format.Timezone.AMERICA_NEWYORK
});
record.submitFields({
type: 'customrecord_dc_wo',
id: wo,
values: {
custrecord_dc_wo_eq_lot_check_created: new Date(formattedDate)
}
})Nicholas Williams
02/20/2024, 8:45 PMbattk
02/20/2024, 8:45 PMbattk
02/20/2024, 8:45 PMbattk
02/20/2024, 8:46 PMbattk
02/20/2024, 8:47 PMNicholas Williams
02/20/2024, 8:50 PMerictgrubaugh
02/20/2024, 8:52 PMNicholas Williams
02/20/2024, 8:58 PMerictgrubaugh
02/20/2024, 9:01 PMNicholas Williams
02/20/2024, 9:02 PMbattk
02/20/2024, 9:05 PMbattk
02/20/2024, 9:05 PMbattk
02/20/2024, 9:06 PMbattk
02/20/2024, 9:07 PMbattk
02/20/2024, 9:07 PMbattk
02/20/2024, 9:08 PMbattk
02/20/2024, 9:08 PMNicholas Williams
02/20/2024, 9:13 PMerictgrubaugh
02/20/2024, 9:19 PMTimothy Wong
02/21/2024, 6:29 AMbattk
02/21/2024, 7:03 AMWatz
02/21/2024, 7:33 AMto_char(sys_extract_utc(systimestamp), 'yyyy-mm-dd"T"hh24:mi:ss"Z"')darrenhillconsulting
02/21/2024, 2:29 PM