Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Count the number of items selected in a multi-select option set in JavaScript

Posted on by Microsoft Employee

Hi all,

Has anyone tried counting the number of items selected in a multi-select option set in JavaScript yet?

I can get values and values names, out fine into a text field but would like to know how to do the above, I'm sure it's possible.

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Count the number of items selected in a multi-select option set in JavaScript

    Ta

  • Verified answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Count the number of items selected in a multi-select option set in JavaScript

    I think that the following will give you the number of selected items:

    Xrm.Page.getAttribute(“new_multiselect”).getValue().length;

    Hope this helps

  • Verified answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Count the number of items selected in a multi-select option set in JavaScript

    Hi Graeme,

    Could you please try with this -

    Xrm.Page.getAttribute(“new_testmultiselect”).getValue().length;

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.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans