Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum
Suggested answer

How to populate Date field from another Entity's date field in javascript ?

Posted on by Microsoft Employee

i did a switch case code to get an attribute type and do something for each type; but when i try to get attribute type of a date it syas that it doesnt exist

how do i get the date type to know how to enter the right case in the switch ?

fieldType = Xrm.Page.getAttribute(fieldDestination[index]).getAttributeType();
                        switch (fieldType) 
                        {
                            case "lookup":
                                do something
                                break;
                            case "string":
                                do something
                                break;
                            case "optionset":
                                do something
                                break;
                            case "": // what should be here for date type? how to get the date AttributeType to know how to get here in this case?
                                do something
                                break;
                            default:
                                console.log(fieldType   "Unkown");
                                break;
                        }

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to populate Date field from another Entity's date field in javascript ?

    Hi Partner,

    You need use 'datetime' to get attribute type of a date.

    getAttributeType (Client API reference) - Power Apps | Microsoft Docs

    pastedimage1634194375713v1.png

    Test:

    pastedimage1634194442427v2.png

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,524 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,493 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans