cancel
Showing results for 
Search instead for 
Did you mean: 

How to update an existing attribute to unique=true

0 Kudos
437

I am trying to update an existing custom attribute to unique=true for an ItemType (ProductReference) which extends GenericItem.

Here the ItemType is ProductReference which is an OOTB item type that is extended from GenericItem.

if I tried to redeclare the attribute getting a build error. redeclare works only when an attribute is defined in the supertype.

items.xml

<itemtype code="ProductReference" autocreate="false" generate="true">
  <description>Extending the ProductReference type from core with additional attributes.</description>
     <attributes>
        <attribute qualifier="attribute1" type="java.lang.String" redeclare="true">
            <modifiers read="true" write ="true" search="true" optional="false" unique="true"/>
               <persistence type="property" />
       </attribute>
     </attributes>
</itemtype>

Accepted Solutions (0)

Answers (1)

Answers (1)

sasethia
Explorer
0 Kudos

You can either create a sub-type or implement the unique constraint using a validate interceptor.