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

Notifications

Announcements

No record found.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 170 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 70

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans