Anyone out there have a working example of cs.save() where you save a “Date and Time”?
I’ve been trying to get it to work, and while the save succeeds the results are a garbage date and time.
The cs.save() call is really simple:
var ts = new Date(2020, 04, 04, 11, 45, 00); // month is an index so 04 = May
cs.log("Date and time = " + ts);
var result = cs.save
(
cs.ref("OCL_FEI_obj_fei_record"),
{
":id" : fei_rec_id,
"OCL_FEI_fld_fei_next_value" : next_value,
"OCL_FEI_fld_fei_last_reset" : ts
}
);
cs.log("Save results = " + JSON.stringify(result));
This version results in the following in the Detective:
‘Date and time = Mon May 04 2020 11:45:00 GMT-0600 (Mountain Daylight Time)
Note that date and time are correct
Saved Record 1027 (OCL>Util> Formatted Entity Identifier) in 0.0053s for rule OCL>R&D> initialize new document
Event Record modified triggered on Record 1027 (OCL>Util> Formatted Entity Identifier)
Save results = {“status”:true,“records”:{“base”:{“record_id”:1027,“action”:“modified”,“fields”:{“:PRO0000130EBEEB1”:{“old”:“20”,“new”:21},“:PRO0000128EBEEB1”:{“old”:“0000-00-00 00:00:00”,“new”:“-0001-11-30 00:00:00”}}}},“subset_review”:null}’
Something that looks like a date has been saved, but it isn’t the right date!
Setting ts thus:
var ts = Date.now();
produces results that look a little more like a valid date, but not the right one:
Date and time = 1588617641295
Saved Record 1027 (OCL>Util> Formatted Entity Identifier) in 0.0038s for rule OCL>R&D> initialize new document
Event Record modified triggered on Record 1027 (OCL>Util> Formatted Entity Identifier)
Save results = {“status”:true,“records”:{“base”:{“record_id”:1027,“action”:“modified”,“fields”:{“:PRO0000130EBEEB1”:{“old”:“22”,“new”:23},“:PRO0000128EBEEB1”:{“old”:null,“new”:“52311-04-16 23:08:15”}}}},“subset_review”:null}
Setting TS to a mySql formatted date string results in a NULL.
So, I’m guessing that I am missing something simple, again.
Thoughts, examples, and loving dope-slaps greatly appreciated.
Regards,
Randy