web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Add OptionSet Value to SelectBox

(0) ShareShare
ReportReport
Posted on by 1,670

hi,

i created two selectBox in the lead entity, each entity not contains any value, i need to add all values in javascript

who can help me ?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    Please refer below.

    sliong.wordpress.com/.../crm-2011-add-new-picklist-option-using-javascript

    Mansoor

  • Ammar Zaied Profile Picture
    1,670 on at

    i visited this link, all values inserted in the picklist but user can't select any value !

  • Ammar Zaied Profile Picture
    1,670 on at

    my source code :

    var options = getDepartmentForRegion(selectedRegion);
    var picklist = Xrm.Page.getControl(picklistName);
    picklist.clearOptions();

    for(i=0;i < options.length; i++)
    {
    var opt = { value : options[i].name , text : options[i].name };
    picklist.addOption(opt);

    }

  • Suggested answer
    Community Member Profile Picture
    on at

    Have you tried with chrome ?

  • Ammar Zaied Profile Picture
    1,670 on at

    yes

  • Ammar Zaied Profile Picture
    1,670 on at

    Updated source code :

    var options = getDepartmentForRegion(selectedRegion);
    	var picklist = Xrm.Page.ui.getAttribute(picklistName);
    	for(i=0;i < options.length; i++)
    	{
    	    var optionObject = document.createElement("option");
    		optionObject.value = options[i].name;
    		optionObject.text = options[i].name;
    		Xrm.Page.getControl(picklistName).addOption(optionObject);
    	   
    	    
    	}


    always the same problem exist, when i selected value always the default value return "--"
    any solution ?
  • Verified answer
    Ammar Zaied Profile Picture
    1,670 on at

    Solution:

    i must define the value in the entity, after i used hide and show.

    Dependent OptionSets (picklists) :

    msdn.microsoft.com/.../gg594433.aspx  but in the parameter i changed "sample_TicketDependentOptionSetConfig.xml" to "sample_TicketDependentOptionSetConfig"  

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Varsha deshpande Profile Picture

Varsha deshpande 5

#2
NeerajPawar Profile Picture

NeerajPawar 2

#2
jlattimer Profile Picture

jlattimer 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans