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!
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!
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
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.
André Arnaud de Cal... 291,711 Super User 2024 Season 2
Martin Dráb 230,458 Most Valuable Professional
nmaenpaa 101,156