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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Populate Date and Time field with current system time on click of field

(1) ShareShare
ReportReport
Posted on by 12

Hi,

I have a requirement where a custom Date and Time field needs to be populated with the current user date and time on click of the field instead of user manually selecting the date and time. 

Using Calculated field with Action Now() leads to the field being populated on form load and that is not what I'm looking for as the field on click triggers a different function. Is there any way I can achieve this? 

Any help is appreciated

Thanks,

Rupal

I have the same question (0)
  • Suggested answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    Hi,

    You mean when Calculated field populate your field value then on change event does not trigger which cause javascript associated to onchange on that filed not gets executed. Correct?

    Can you try using Business Rule to set current date and time instead of using Calculated field.

    Please mark my answer verified if i were helpful

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi partner,

    You can also try using workflow or js to populate date time automatically.

    1.workflow.

    Create an on-demand workflow and populate date field with dynamics value--Execution Time.

    pastedimage1601262537415v1.png

    pastedimage1601262564240v2.png

    2.Js.

    function updateDateField(executionContext) {
       var formContext = executionContext.getFormContext();
       var date = formContext.getAttribute("new_date");
       var currentDateTime = new Date();
       date.setValue(currentDateTime);
    }

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

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…

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 93 Super User 2025 Season 2

#2
TAHER_El_Mehdi Profile Picture

TAHER_El_Mehdi 30

#3
Satyam Prakash Profile Picture

Satyam Prakash 24

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans