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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

How to set date field in Microsoft portals using javascript

(0) ShareShare
ReportReport
Posted on by

Hi All,

I have a requirement to populate a date field on crm portal.

The date is coming from an odata feed, but I am not sure of the correct syntax to populate the field

The data format of the date field is DD/MM/YYYY

i'm sure someone has done this before, but I am unable to find a solution.

Any ideas would be appreciated

I have the same question (1)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    Check this - bernado-nguyen-hoan.com/.../

  • Community Member Profile Picture
    on at

    Hi Andrew,

    This is the error I get

    pastedimage1573092002813v1.png

    and this is the data i'm getting from the odata feed

    pastedimage1573092267545v2.png

    Any ideas?

  • Verified answer
    ajyendra Profile Picture
    1,738 on at

    Hi,

    date = new Date('2019-11-12T00:00:00Z');

    year = date.getFullYear();

    month = date.getMonth()+1;

    dt = date.getDate();

    if (dt < 10) {

     dt = '0' + dt;

    }

    if (month < 10) {

     month = '0' + month;

    }

    console.log(dt+'/' + month + '/'+year);

    For Moment you have to use cdn or refernce of moment.js file. You can easily do with in only one statement

    moment("2019-11-12T00:00:00Z").format('DD/MM/YYYY')

    https://community.dynamics.com/crm/b/thinkdynamicdodynamic/posts/set-or-auto-populate-value-in-date-field-crm-portal

  • Community Member Profile Picture
    on at

    Thank you Ajyendra

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 Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 202 Super User 2026 Season 1

#2
CU11031447-0 Profile Picture

CU11031447-0 100

#3
NeerajPawar Profile Picture

NeerajPawar 70

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans