I would like to thank Guido for the help on my previous post:

Now on the entity Lead we have a customized multiselect field.

I have this message displayed when I created a new lead.

 

There was an error with this field’s customized event.

Field:crmForm

Event:onsave

Error:Object doesn’t support property or method ‘saveMultiSelect’

Here's is the JavaScript code of the multiselect

 

// var_sc_optionset >>  Provide schema-name for Option Set field // var_sc_optionsetvalue >> Provide schema-name for field which will store the multi selected values for Option Set // OS >> Provide Option Set field object // OSV >> Provide text field object which will store the multi selected values for Option Set

//Method to convert an optionset to multi select Option Set function ConvertToMultiSelect(var_sc_optionset, var_sc_optionsetvalue, OS, OSV) {

if( OS != null && OSV != null ) {   OS.style.display = "none";   Xrm.Page.getControl(var_sc_optionsetvalue).setVisible(false);

  // Create a DIV container   var addDiv = document.createElement("<div style='overflow-y:auto; height:80px; border:1px #6699cc solid; background-color:#ffffff;' />");   OS.parentNode.appendChild(addDiv);

  // Initialise checkbox controls   for( var i = 1; i < OS.options.length; i++ )   {     var pOption = OS.options[i];     if( !IsChecked( pOption.text , OS, OSV) )       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

    OS.nextSibling.appendChild(addInput);     OS.nextSibling.appendChild(addLabel);     OS.nextSibling.appendChild(addBr);   } } }

///////Supported functions

  // Check if it is selected   function IsChecked( pText , OS, OSV)   {     if(OSV.value != "")     {       var OSVT = OSV.value.split(";");       for( var i = 0; i < OSVT.length; i++ )       {         if( OSVT[i] == pText )           return true;       }     }     return false;   }

  // var_sc_optionsetvalue >> Provide schema-name for field which will store the multi selected values for Option Set   // OS >> Provide Option Set field object   // Save the selected text, this field can also be used in Advanced Find   function OnSave(OS, var_sc_optionsetvalue)   {     var getInput = OS.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_sc_optionsetvalue);     attribute = control.getAttribute();     attribute.setValue(result);

  }

 

 

Thanks in Advance for looking at it