Set Option Set by OptionSet Text

function SetValue(optionsetAttribute, optionText)
 var options = Xrm.Page.getAttribute(optionsetAttribute).getOptions();
 for(i = 0; i < options.length; i++)
  if (options[i].text == optionText)

Calling of the function

SetValue("new_country", "India")


Popular posts from this blog

Workflow Activity Input and Output Parameters and Data Types in MS CRM 2013/15/16

Get Workflow Guid in Javascript using OData query

Convert Plugin to Sandbox mode,