Skip to main content

Notifications

Announcements

No record found.

Service | Customer Service, Contact Center, Fie...
Answered

Separate date and time

(0) ShareShare
ReportReport
Posted on by 225

I need the date of the actualend-field from the activity-entity. But the field saves time and date and I can't chance the settings to only date. I'm going to usw them in a flow. Is there a way to seperate them?    

  • Verified answer
    LeoAlt Profile Picture
    LeoAlt 16,329 on at
    RE: Separate date and time

    Hi partner,

    As ba365guy said that we could not change the type of field since it has been published. I suggest that you could create another text field and use js code to get the date from actualedn-field and set it as a value to your new field.

    function onLoadDate(executionContext){
        var formContext = executionContext.getFormContext();
        var date1=formContext.getAttribute("new_dataandtime").getValue();
        if(date1!=null&&date1!=undefined){
            var time1=new Date(date1);
            var year=time1.getFullYear();
            var month=time1.getMonth()+1;
            var day=time1.getDate();
            var date2=year+"-"+month+"-"+day;
            var time2=new Date(date2);
            formContext.getAttribute("new_dateonly").setValue(time2);
        }
        
    }

    Hope it helps.

    Best Regards,

    Leo

  • Suggested answer
    ba365guy Profile Picture
    ba365guy 2,946 on at
    RE: Separate date and time

    Hi Ar0x

    I am afraid making changes to out of the box "activity" entity is not supported. 

    System doesn't allow you add / modify the fields in this entity. 

    You might choose to do changes (using new field / JavaScript) in "Task" entity (if it supports your requirement). 

    pastedimage1576256743890v1.png

    pastedimage1576256760268v2.png

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Separate date and time

    Hello,

    You can add a separated field and extract pure data into it using JS (like this - www.w3schools.com/.../jsref_getdate.asp) or plugin and use other field in your flow afterwards.

  • Suggested answer
    ashish12 Profile Picture
    ashish12 3,079 on at
    RE: Separate date and time

    Change the field type to Data only than Date and Time.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans