-2
Custom_Object__c co = new Custom_Object__c(Name='TEST', Date_of_Visit__c=2019-06-06);
insert co;
  • 2
    You will need to provide exact code and field details here. If this is what you have then there are quite a few issues here. Your custom object should always end with '__c' and then the way you are populating the date is not correct either, assuming that it’s a date field. – Jayant Das Jun 6 at 23:20
4

You haven't provided much in the way of details here, but I'd suspect that your issue is with the date you're trying to set to Date_of_Visit__c

I know that SOQL queries can handle date literals, but I don't think that the rest of Apex at large can.

You should create an instance of the Date class using something like Date.valueOf(), and set your Date field equal to that instead.

  • 1
    Also seems the custom object name here is an issue. At least with the level of information provided. – Jayant Das Jun 6 at 23:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.