Hii, I have an entity country that has an area code integer field that only allows only 5 characters (ex 00961)
how can I do it ?
*This post is locked for comments
Hi Faith,
You can set the value using the Javascript.
Xrm.Page.getAttribute("areacode").setValue(00961);
Hope this helps.
Hi Nithya,
Thank you for helping ..
I need the user to set the value but no more than 5 characters to put his area code..
Thank youu
Hi,
You could validate the area code using the code below using regular expression.
var areaCode = Xrm.Page.getAttribute("areacode").getValue(); var regularExpression = /[0-9]{0,5}/; if (!areaCode.match(regularExpression )) { { Xrm.Page.getAttribute("areacode").setValue(); alert("Maximum of 5 characters is required"); } }
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 Abhilash Warrier as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
HR-09070029-0 2
ED-30091530-0 1