Closed luscala closed 6 years ago
Ok, this problem is caused from DateTime to String conversion. With a CustomCall class, which has a String DateStart property (overriding the main one), used to pass to the CRM the date/time in the format "yyyy-MM-dd HH:mm:ss" (instead of "yyyy-mm-ddTHH:mm:ss"), it works. Is there a way to mod the default output of SugarRestSharp for DateTime properties? Thanks
SOLVED! I had a look to Newtonsoft website and found the way. I wrote a CustomDateTimeConverter class (which inherits from IsoDateTimeConverter), where I set my DateTimeFormat (yyyy-MM-dd HH:mm:ss). Then in a CustomCall class I set the default converter for DateTime format to be the custom one.
class CustomDateTimeConverter : IsoDateTimeConverter
{
public CustomDateTimeConverter()
{
base.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
}
}
public class CustomCall : Call
{
[JsonConverter(typeof(CustomDateTimeConverter))]
[JsonProperty(PropertyName = "date_start")]
public virtual DateTime DateStart { get; set; }
}
I am glad you found solution to the problem. Sorry for the late response.
Hi @mattkol, I am having a first look to your SugarRestSharp. In particular, I wrote a command-line utility to bulk-create calls and meetings. I am trying to set DateStart and DateEnd but on the CRM I see those fields empty. Duration (hours and minutes) works fine. I am using SuiteCRM 7.8.7 LTS.
Thanks