Announcements
Is it possible to restrict Choices in a choice field in a model driven app? I have a choice field with three choices and I only want the user to choose a max of two of the three.
Hi @MikeBlairTP ,
Please try this script in onchange event.
function test2(context) { if (!(context.getFormContext().getAttribute("crba2_test_choices").getValue() === null) && context.getFormContext().getAttribute("crba2_test_choices").getValue().length > 2) { context.getFormContext().getAttribute("crba2_test_choices").setValue(null); } }
Best Regards,
Wearsky
Hi @v-xiaochen-msft
I've created script and saved it to the web resources library. Selected the field where the choice field is. Tested it but I was able to select more than 2 choices. I have some extra options, what do I need to add?
Please try to tick the option.
Getting close, when I select one item from the choice field I get the below
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.
Congratulations to our community stars!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.
11manish 397 Super User 2026 Season 2
Mohsin Ali 354
WarrenBelz 232 Most Valuable Professional