D365 Customization Barriers and How to Overcome Them: ohya's Practical Diary [#004] ~When you open a form, "today's date" is automatically entered!? A smart solution with JavaScript~
Hello, this is ohya.
This time, we will introduce how to automatically enter today's date when opening a form in Dynamics 365.
"Well, that's easy, right?" you might think.
Actually thisThis cannot be done with Power Automate or business rules.That's it...!
At first glance, it may seem like a simple requirement, but it's actually surprisingly complex!
🛠️This time's wall: "I want to have 'Today' pop up the moment I open the form!"
We created a "Contact History" table to record sales activities.
In the "Contact Date" field,I want "today's date" to be automatically entered when the form is opened.There was a request.
But here's the problem...! I couldn't achieve my goal using the usual methods.
❌ Why the usual method didn't work
-
- Business Rules → There is no function to set "Today's date"
- Power Automate → It only works when it is saved
- When you open the formPower Automate will not respond because no records have been created yet!
In other words, a different approach was needed to enable "insertion the moment the form is opened."
✅ Solution: Real-time input with JavaScript!
Therefore, this time we adopted a method that uses JavaScript to automatically enter "today's date" when the form is displayed .
1. Create a JavaScript web resource
First, include the following code: .js Create the file:
2. Add a web resource to your form
- Open the form editor
- Add the above JS file to "Form Library"
- On the "form load" event
setTodayDateRegister a function executionContextDon't forget to set it to pass!

3. Operation check
The moment you open the form, today's date will be automatically entered into the "Contact Date" field!
✅ Summary
- Requirements that cannot be achieved with business rules or Power Automate can be solved with JavaScript!
- To "Set values when form is opened"Form Events + JavaScriptis valid
- With a small ingenuity,Reduces user effort and errorsThat's the fun of customization!
✍️ Conclusion
Even a little auto-fill can be a big help to users.
Like this time,Real-time input assistance using JavaScriptgreatly expands the scope of customization for D365.
Next time, I'll be sharing the knowledge I've gained through hands-on experience, so stay tuned!
Person who wrote this article
Articles in the same category
-
Why you should invest in CRM now [Series 3] Why "any CRM will do" […] -
Why you should invest in CRM now [Series 2] Another invisible crisis […] -
Why you should invest in CRM now [Series 1] What companies that survive recessions do […] -
Risks of managing customer information in Excel — Losing a computer can lead to other problems […] -
Japanese companies' customer information is being targeted from all over the world — now, CRM is being used to […] -
Mutual Aid and Welfare System Utilization Guide — EMOROCO CRM[…]
