Hello experts, recently I encountered the following problem:
Context: There are 4 fields in the contact form: birthday, child (checkbox), email and telephone number. So in general, the fields email and telephone are mandatory; but since if it is a child, these information might not be necessary, we set up a business rule which basically says if the checkbox is checked, these two fields are not mandatory anymore.
On the other hand, in order to facilitate the sales process, we use JS to calculate the age of the child and checked the checkbox automatically if age is less than 18. For example: when I entered 02/08/2016, the age field will be filled with 1, and the check box will be checked.
The problem is when I manually checked the checkbox, the business rule will work and hence the fields email and telephone are no more mandatory, but when I entered first the birth date, and JS automatically checked the checkbox, the business rule doesn't work. So why the business rule didn't take the JS results into account ?
Thank you all for your help and have a nice day.
Cheers,
Yi
*This post is locked for comments
I would try using
Xrm.Page.getAttribute("CHECKBOXATTRIBUTE_NAME).fireOnChange()
in your javascript right after you have set the checkbox
Hi,
here is your answer: community.dynamics.com/.../221799
You can also replace your business rules by a Javascript function which verifies the above condition. Simply call this function onLoad of the form and onChange of this checkbox.
Best
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156