Asked by:
Crm 2013 Dynamic Option Set Problem

Question
-
Hi,
I have a very simple example that add element to an optionset. Another function works onchange of this option set field. But when I select the value of option set that ı've added dynamically does not trigger onchange function. Rollup 3 installed into the system.
Any Ideas?
var entityoptionset = Xrm.Page.getControl("optionsetfield"); var opt1 = new Option(); opt1.text = 2; opt1.value = 2; entityoptionset.addOption(opt1);
Polat Aydın Crm Software Developer
Friday, August 29, 2014 1:17 PM
All replies
-
You may try adding this code in PageLoad :
crmForm.all.yourattributename.onclick = function () {
crmForm.all.yourattributename.FireOnChange();
};Hope it helps!
Hina
- Proposed as answer by HinaMehtaMicrosoft employee Friday, August 29, 2014 4:22 PM
- Unproposed as answer by Polat Aydın[MCP] Friday, August 29, 2014 8:34 PM
Friday, August 29, 2014 4:10 PM -
This is CRM 2013 not 4.0. It is not a good way using like this codes.If ı want I can attach element click but it is not my question. My question is it is bug or in CRM 2013 something has different from CRM 2011 for adding elements to option set dynamically.
Polat Aydın Crm Software Developer
Friday, August 29, 2014 8:38 PM -
Hello,
I thought adding dynamic option set was possible in CRM 2013. But I stand corrected by ravitheja.
regards
Jithesh
- Proposed as answer by JLattimerMVP, Moderator Saturday, August 30, 2014 6:34 PM
- Unproposed as answer by Polat Aydın[MCP] Monday, September 1, 2014 8:11 AM
Friday, August 29, 2014 11:49 PM -
You aren't able to add an option to an option set that isn't already defined in the system.
This reference from the SDK indicated as such: http://msdn.microsoft.com/en-us/library/jj602964.aspx#BKMK_OptionSetControls
This example (showing dependent option sets) shows how you might manipulate existing values:
http://msdn.microsoft.com/en-us/library/gg594433.aspx
Jason Lattimer
My Blog - Follow me on Twitter - LinkedIn- Proposed as answer by JLattimerMVP, Moderator Saturday, August 30, 2014 6:34 PM
- Unproposed as answer by Polat Aydın[MCP] Monday, September 1, 2014 8:11 AM
Saturday, August 30, 2014 6:34 PMModerator