I had a line item with a multiselect feature. It was working and saving fine but without any code change all the sudden it does not save correctly, if I select 3 items it only highlights two items and so on. Not sure why, is this a known bug of some sorts, where should I check to find the problem?
VF
<apex:SelectList rendered="{!contains(di.dataType, 'Multipicklist')}" size="5" value="
{!di.multiSelect}" multiselect="true">
<apex:SelectOptions value="{!di.pickList}" />
</apex:SelectList>
Apex
public String[] multiSelect {get; set;}
Method used to create the list options, which works
private List<SelectOption> createLists(string content) {
List<SelectOption> pickList = new List<SelectOption>();
List<String> options = content.split(';');
for (String value : options)
pickList.add(new SelectOption(value, value));
return pickList;
}
if ( dataType.equals('Multipicklist')) {
//content is the list of selection options retrieved from another object.
object.pickList = createLists(content);
}
These are code snippets of the relevant parts and it is fairly safe to assume the other components are working.
If anyone can offer suggestions it would be greatly appreciated. This link kind of illustrates my bug as well: https://success.salesforce.com/issues_view?id=a1p30000000T21lAAC //additional comments on Save
Stores the selected values in Value__c
When I load them again after save and refresh I use this code:
//Iterates through each line item
public String[] multiSelect {get; set;} // stores the selected multiselect values
//
if (datatype = 'Multipicklist')
{
//value__c is the salesforce field where I store my selected values.
subClassObject.multiSelect = salesforceObject.Value__C.split(';');
}