iceMan33
iceMan33

Reputation: 369

eti default value on entity

Is it possible to change the default value or a field in an eti without messing up the production database? There is a drop down that defaults to other that I would like to default to another value in the dropdown. I don't want to mess up the database though. Is there another way to set the default value on the drop down besides the eti file it's self?

Upvotes: 1

Views: 1475

Answers (2)

hakamairi
hakamairi

Reputation: 4678

Why would you mess the DB?

Default value in SQL actually sets this value for the fields that are NULL during input. This shouldn't require a DB drop and shouldn't break anything.

As for changing this. If that's not OOTB entity, you should be able to do that in .eti.

As to your use case - what are the values in the drop down? I would assume that's a typelist, and that's what you really should modify (look for priorities there).

EDIT To override a column for example for OOTB entity User.eti

  • Open User.etx or create it if it doesn't exists. modules\configuration\config\extensions\entity\User.etx.

  • Right click on a column that you would like to override - ExternalUser in your case. Pick override.

  • at the top of the list a column-override should be created - change the default value there.

Upvotes: 1

orpho
orpho

Reputation: 136

If it's an OOTB .eti file than you should create a .etx file and override the default attribute value with <column-override> or <typekey-override> elements (there are also other override elements that you can use depending on the element type, e.g. <array-override>, <foreignkey-override> etc.), for example:

User.eti:

  <column
    default="false"
    desc="Example"
    name="EntityName"
    nullok="false"
    type="bit"/>

User.etx:

  <column-override
    default="true"
    name="EntityName"/>

Overriding attribute' default value will affect only new data; it will not change values that already exist in the DB. If you need to change the old data you can use upgrade version triggers (BeforeUpgradeVersionTrigger or AfterUpgradeVersionTrigger).

Upvotes: 1

Related Questions