web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Portal Basic Form - Da...
Power Pages
Unanswered

Portal Basic Form - DateTime Field filled with Value from existing Opportunity value

(0) ShareShare
ReportReport
Posted on by 92

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:

GeraldGut_0-1664550617489.png

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:

GeraldGut_1-1664550814127.png

Thx for your help.

 

Best regards

Gerald Gut

Categories:
I have the same question (0)
  • ragavanrajan Profile Picture
    7,044 Most Valuable Professional on at

    Hi @GeraldGut 

     

    For Power Pages / Portal, the site setting controls the date format. 

     

    Official URL: Please click here 

     

    Also, please have a look at the below thread, which I answered a while ago 

    https://powerusers.microsoft.com/t5/Power-Apps-Portals/Configuring-Custom-Date-Format-in-PowerApps-Portals/td-p/1485639 

     

     


    Hope it helps. 
    ------------

    If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
rezarizvii Profile Picture

rezarizvii 55

#2
11manish Profile Picture

11manish 48

#3
Valantis Profile Picture

Valantis 46

Last 30 days Overall leaderboard