Notifications
Announcements
No record found.
I need to create a numerical field with 13 characters long. But need validation so that users cannot incorrectly add any number that is too long or too short. is there any OOTB validation we can added with this field?
Thanks!
Hi Ivy,
you need to write the simple javascript without that it is not possible OOB.
function Validation(executionContext) { var formContext = executionContext.getFormContext(); var test = formContext.getAttribute("new_test1").getValue(); var control = formContext.getControl("new_test1"); if (test !== "") { if (isNaN(test)) { control.setNotification("Please enter only numbers", "CHKNUM"); } else if (test.length != 13) { control.setNotification("Please enter only 13 characters", "CHKNUM"); } else{ control.clearNotification("CHKNUM"); } } }
You can refer following link to add the JS to form.
https://reenhanced.com/2019/how-to-get-started-with-form-scripts-in-dynamics-365/
Regards,
Leah Ju
Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.
You could also achieve the same by using an existing PCF Control 'input mask' on the form attribute (i.e. without JavaScript)
docs.microsoft.com/.../additional-controls-for-dynamics-365-for-phones-and-tablets
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Tom_Gioielli 83 Super User 2025 Season 2
Gerardo RenterÃa Ga... 49 Most Valuable Professional
#ManoVerse 40