Trouble updating database with multi-select options group within a field group

having issues understanding how to save changes of a multi-select checkbox options group to the database. I make the selections in the edit window, and save the record, but upon reopening, the changes are not reflected. Here is my edit controller code below:


public class RFIEdit extends AbstractEditor<RFI> {

    @Inject
    private FieldGroup fieldGroup;
    @Inject
    private ComponentsFactory componentsFactory;
    @Inject
    private OptionsGroup optionsGroup;

    @Override
    public void init(Map<String, Object> params) {
        super.init(params);
        fieldGroup.addCustomField("impacts", (datasource, propertyId) -> {
            optionsGroup = componentsFactory.createComponent(OptionsGroup.class);
            optionsGroup.setOptionsEnum(RFIImpact.class);
            optionsGroup.setMultiSelect(true);
            optionsGroup.setOrientation(OptionsGroup.Orientation.HORIZONTAL);
            return optionsGroup;
        });

    }

}

I’m not sure what additional code i need to add in order for the database to accept the changes.

Thanks.

RFIEdit

Hi Raymond,

Firstly, what platform version do you use? fieldGroup.addCustomField() is deprecated, we recommend you to use the new FieldGroup API.

Next, what is your data model? Enumeration attributes cannot be multi-selected, as far as they are stored in DB as one String/Integer.

Please clarify the relationship between RFI and Impact(s) in your data model.

Hi Olga,

Sorry for the late response.

I’ve been able to solve this by removing my optionsGroup from the auto-generated fieldGroup, and adding it as a separate component with the appropriate datasources attached, and it works fine.

Thanks Again for a great product!!