How to get the selected value from the set crm 4 dynamic 2011 online option

This is a javascript related issue with crm 4 2011 online

I created the -status: open, closed parameter and an onchange event handler that calls the run function with the context parameter as the parameter.

In js, I tried the following and more:

function run(selectedItems) { var s = selectedItems[0]; } 

But I always get the variable undefined.

How to get the selected value from a set of parameters?

thanks

EDIT:

I tried

 function run() { alert("hello"); var texter = Xrm.Page.getAttribute("new_state_request").getSelectedOption().text; alert(texter); } 

just now. Gettin this: Error in custom event of this field. field: new_state_request Event: OnChange Error: undefined

+4
source share
2 answers

these are the correct methods with the optionset attribute, for more information, follow this link:

http://msdn.microsoft.com/en-us/library/gg334409.aspx

get the text of the selected option

 Xrm.Page.getAttribute("fieldname").getText(); 

get the numerical value of the selected option

 Xrm.Page.getAttribute("fieldname").getValue(); 
+9
source

to try

Get Selected OptionSet Field Text

 Xrm.Page.getAttribute("CRMFieldName").getSelectedOption().text; 

Get the selected value of the OptionSet field

 Xrm.Page.getAttribute("CRMFieldName").getSelectedOption().value; 
+2
source

Source: https://habr.com/ru/post/1482583/


All Articles