1

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?

iceMan33
  • 359
  • 2
  • 16

2 Answers2

1

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.

hakamairi
  • 4,464
  • 4
  • 30
  • 53
  • It's an OOTB eti. "User.eti". I can only edit default value if I open the file in notepad++ and change it there but then I get " Inconsistent data model: vertical datamodel exists with version (5, 89, 12, 410), but the datamodel definition has changed." That is why I raised this question. I don't want to have to drop a DB. Also, if I change priorities that just changes the order they appear in the drop down. It still sets the first one to the default value. – iceMan33 Apr 09 '19 at 12:04
  • You shouldn't modify the `.eti` of OOTB entity. You would have to create an `.etx` for that. Again if that's about a drop down, you should modify the values there. – hakamairi Apr 09 '19 at 12:23
  • So there is no way to change a radio button that is by default set to "false" if these are coming from an eti? If I created an etx i would have to create a new field and use that new field wouldn't i? That means I would have to change a lot of code in the project to use the new field. I just want to change the default value from the original eti. – iceMan33 Apr 09 '19 at 12:41
  • Which column you want to change? – hakamairi Apr 09 '19 at 13:18
  • User.eti - ExternalUser to default to true. User.eix - UserType to default to producer – iceMan33 Apr 09 '19 at 13:21
  • I've right clicked and override the ExternalUser field and made the default true. But on the UI it still has false preselected on the radio button. – iceMan33 Apr 09 '19 at 15:24
  • As mentioned before, what are the values you use in the drop down? Is it a type list? – hakamairi Apr 10 '19 at 07:05
  • One field is a typelist that has 5 values and the preselected one is not the one I want. The other field is a radio button that is preslected to no. I want that to be preselected to yes. I've created an etx and override the original field and changed the default and started server and still doesnt do it. – iceMan33 Apr 10 '19 at 12:29
1

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).

orpho
  • 126
  • 1
  • 6
  • I've right clicked and override the ExternalUser field and made the default true. But on the UI it still has false preselected on the radio button. – iceMan33 Apr 09 '19 at 15:24
  • Is it still `false` when you are trying to create a new user (Actions menu -> New User -> Profile Tab)? If yes, then probably there is also some logic associated with this .pcf file that sets this value to false (check if there any page process added to this .pcf file or any code in the code tab). – orpho Apr 10 '19 at 15:34