Skip to main content

Notifications

Announcements

No record found.

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

  • Verified answer
    Ammar Zaied Profile Picture
    Ammar Zaied 1,670 on at
    RE: Add OptionSet Value to SelectBox

    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"  

  • Ammar Zaied Profile Picture
    Ammar Zaied 1,670 on at
    RE: Add OptionSet Value to SelectBox

    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 ?
  • Ammar Zaied Profile Picture
    Ammar Zaied 1,670 on at
    RE: Add OptionSet Value to SelectBox

    yes

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Add OptionSet Value to SelectBox

    Have you tried with chrome ?

  • Ammar Zaied Profile Picture
    Ammar Zaied 1,670 on at
    RE: Add OptionSet Value to SelectBox

    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);

    }

  • Ammar Zaied Profile Picture
    Ammar Zaied 1,670 on at
    RE: Add OptionSet Value to SelectBox

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

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Add OptionSet Value to SelectBox

    Please refer below.

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

    Mansoor

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 Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans