How to get multiselect field values in before save hooks logic

I have a multi select field in custom module.I need the selected values of this field in before save hook logic.

i am trying this:
$values=$bean->fieldname

but its giving me if i select two value ^1^,^2^
how can i select the values?

This is the format it is saved in the database. You can use unencodeMultienum($field) to put it into an array

1 Like

how can i do this?there is only one type of multiselect field.
Is code change will require?please explain how i can use unencodeMultienum.

From your code you would do:


$values = unencodeMultienum($bean->fieldname);
//$values is now an array of what is selected in the multi select
foreach($values as $value){
}