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

Notifications

Announcements

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

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Shidin Haridas Profile Picture

Shidin Haridas 2

#2
Abdullah13 Profile Picture

Abdullah13 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans