I am converting the option set field to pick list , for this I have created one option set field and multiline text field and done the coding as follows:
I have done the same with 2011 it worked well but for 2013 I am not able to convert .
and when I kept alert(""); like this nothing is shown .... is the command problem or function itself not called? I called the function correctly .
//Start ---------------- Multi Select Picklist ---------------------
//Update >> Provide schemaname for picklist field
var var_new_picklist = 'new_its_solutioncategory';
//Update >> Provide schemaname for field which will store the multi selected values for picklist
var var_new_picklistvalue = 'new_its_solutioncategoryvalue';
//Method to convert picklist to multi select picklist
function ConvertToMultiSelect()
{
// PL - the picklist attribute; PLV - used to save selected picklist values
//Update >> Provide picklist schema name
var PL = document.all.new_its_solutioncategory;
//Update >> Provide field name which will store the multi selected values for picklist
var PLV = document.all.new_its_solutioncategoryvalue;
//alert(PLV);
if( PL != null && PLV != null )
{
PL.style.display = "none";
Xrm.Page.getControl(var_new_picklistvalue).setVisible(false);
// Create a DIV container
var addDiv = document.createElement("<div style='overflow-y:auto; height:80px; border:1px #6699cc solid; background-color:#ffffff;' />");
PL.parentNode.appendChild(addDiv);
// Initialise checkbox controls
for( var i = 1; i < PL.options.length; i++ )
{
var pOption = PL.options[i];
if( !IsChecked( pOption.text , PL, PLV) )
var addInput = document.createElement("<input type='checkbox' style='border:none; width:25px; align:left;' />" );
else
var addInput = document.createElement("<input type='checkbox' checked='checked' style='border:none; width:25px; align:left;' />" );
var addLabel = document.createElement( "<label />");
addLabel.innerText = pOption.text;
var addBr = document.createElement( "<br/>"); //it's a 'br' flag
PL.nextSibling.appendChild(addInput);
PL.nextSibling.appendChild(addLabel);
PL.nextSibling.appendChild(addBr);
}
}//end of if
}//end of function
///////Supported functions
// Check if it is selected
function IsChecked( pText , PL, PLV)
{
if(PLV.value != "")
{
var PLVT = PLV.value.split(";");
for( var i = 0; i < PLVT.length; i++ )
{
if( PLVT[i] == pText )
return true;
}
}
return false;
}
// Save the selected text, this field can also be used in Advanced Find
function OnSave()
{
//Update >> Provide picklist schema name
var PL = document.all.new_its_solutioncategory;
var getInput = PL.nextSibling.getElementsByTagName("input");
var result = '';
for( var i = 0; i < getInput.length; i++ )
{
if( getInput[i].checked)
{
result += getInput[i].nextSibling.innerText + ";";
}
}
//save value
control = Xrm.Page.getControl(var_new_picklistvalue);
attribute = control.getAttribute();
attribute.setValue(result);
}//end of function OnSave()
//End ---------------- Multi Select Picklist ---------------------
I have done the same with 2011 it worked well but for 2013 I am not able to convert .
and when I kept alert(""); like this nothing is shown .... is the command problem or function itself not called? I called the function correctly .