Search code examples
sage-crm

Sage CRM - How to save a date with using the object returned from CRM.FindRecord()


Given this code:

var ToDateDate = new String(Request.Form("Comm_ToDateTime"));
ToDateDate = ToDateDate.split("/");
var newToDateTime = ToDateDate[2]+"-"+ToDateDate[1]+"-"+ToDateDate[0]+" "+Request.Form("Comm_ToDateTime_TIME")+":00.000";
CurrentCommunication("Comm_ToDateTime") = newToDateTime;
CurrentCommunication.SaveChanges();

How can i save the date?

This way the date (as Days, month and year) got saved but the hours, minutos does not.

The final output for the newToDateTime variable is 2016-19-09 08:50:00.000

if i use this value (2016-19-09 08:50:00.000) in a barehand SQL update, it works


Solution

  • Turns out that i have to build the Date object with the values and then use getVarDate() mehtod to to pass from a Date Javascriopt object to a record’s date field value which at the end it is the same i was doing :S

    Found my answer in this Sage CRM Community