How can a single item picklist for a lead be mapped to a multi-select account picklist

It is a long story as to why (related to our sales process and marketing automation system), but I need to figure out a way to map a single select picklist in a lead to a multi-select picklist in an account.

It can’t be done by default, but is there a way to override that?

Answer

The only way to do this is with apex, either a visualforce page for lead conversion or a trigger. Here is a handy method for adding to a multiselect field:

private String AddToMultiselect(string MultiselectValue, string AddedValue) {  

    string NewMultiselectString = ''; 

    Set<string> MultiselectValueSet = new Set<string>();
    if( MultiselectValue != null ) {
        NewMultiselectString = ';' + MultiselectValue;
        MultiselectValueSet.addAll( MultiSelectValue.split(';') );
    }

    if (addedValue != null) {
        for( string newValue : AddedValue.split(';') ) {
            if ( newValue != null && !MultiselectValueSet.contains(newValue) ) {
                NewMultiselectString += ';' + newValue;     
                MultiselectValueSet.add(newValue);
            }
        }
    }

    return (NewMultiselectString == '') ? null : NewMultiselectString.substring(1); 
}

Attribution
Source : Link , Question Author : Greg P , Answer Author : greenstork

Leave a Comment