If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.
Then you search for your filed block in the json and only replace the type value from enum to multiEnum, this is an example.
Or if you dont have access to the files you can remove the field and re-add a new field with THE SAME NAME, espocrm will not remove the column from the database, so that the values will remain with the new field.
Never knew about the "remove field name" trick. That is good to know. Adding this to Learning EspoCRM.
But question is, it won't work for all field right? e.g you can't delete a varchar field and create a new intreger field. But something that is similar can be done, e.g. eNum > multiEnum?
Never knew about the "remove field name" trick. That is good to know. Adding this to Learning EspoCRM.
But question is, it won't work for all field right? e.g you can't delete a varchar field and create a new intreger field. But something that is similar can be done, e.g. eNum > multiEnum?
Yes true. This can be done with similar fields like you said.
Hello, I thought i'd give some feedback - i needed to do this for a field and tried it for changing enum to multiEnum for the type field in the Contacts entity, but found that after the change (editing the json), where there had been a value in the Type field this was now blank. So it looks like it does work, but you lose your existing data,
So I can retain the data I'm going to try exporting record ID and the type field, then import back in after the change.
Hey shalmaxb, thanks for the reply, yep I did try a rebuild, the field is just empty after making the change to multienum. It shows correctly in Entity manager as multi-enum, so change has taken effect ok. I guess the format of the object in the backend DB for enum vs multi-enum is different. No worries, I will go with the option of doing export/import.
FYI enum and multienun are both stored by the database as varchar, but their contents are two different things:
Enum fields are stored as simple varchar value corresponding to the choice selected in the enum field display.
For example, assuming that you have an enum field with the choices: "Option 1", "Option 2" and "Option 3" and you select "Option 3", the varchar field in the table will have the string "Option 3"
Multi-enum fields are stored as an array inside de varchar, with one element for each choice selected in the multi-enum field display.
Asuming that you have a multi-enum field with the same choices as above, and you select "Option 1" and Option 3", the varchar content will be "[Option 1, Option 3]"
Comment