Hy everybody,
I have another request.
I am trying to prefill a DateTime field with a date value from CRM.
Therefore I am using Javascript with Liquid to retrieve opportunity data and field value and then set the value to the DateTime field.
My problem now is, that the value is set and represented correctly. But as soon I try to save the form on Portal side an error occurs:
Google translated:
"Estimated Ship Date must be in a valid date format. Example {1}"
The JS as follow:
{% assign id = request.params['id'] | escape %}
{% assign opportunity = entities.opportunity[id] %}
var Datum = "{{opportunity.estimatedclosedate}}".substring(0,10);
var arr = Datum.split('.');
arr[1] = arr[1] - 1;
var NewDate = new Date();
NewDate.setMonth(arr[1]);
NewDate.setDate(arr[0]);
NewDate.setFullYear(arr[2]);
$( document ).ready(function() {
debugger;
// Display Field
$("#rep_voraussichtiches_versanddatum_datepicker_description").val(NewDate.toLocaleDateString('de-CH', options));
$('#rep_voraussichtiches_versanddatum').next().data("DateTimePicker").minDate(moment().add(3, 'days')); $('#rep_voraussichtiches_versanddatum').next().data("DateTimePicker").daysOfWeekDisabled(['0', '6']);
});When I change the datevalue using the datepicker it is working and the value is set correctly.
I think it has something to do with the date formatting, but I do not know what and how to change it.
What format is expected to be set in the date field?
The portal form looks like this:
Thx for your help.
Best regards
Gerald Gut

Report
All responses (
Answers (