on 08-31-2023 4:45 PM
Hello everyone,
I would like to know if it is possible to set a default value for a specific attribute when you declare an item in the *core-items.xml. In particular, I need to specify a default string value. I see that I can do that for primitive types, but I can't find any answer for no primitive types. I tried to write it in the following way as specified here https://stackoverflow.com/questions/63314600/how-to-set-default-value-for-a-map-attribute-of-an-item...
<attribute generate="true" autocreate="true" qualifier="robotsDescription" type="localized:java.lang.String">
<persistence type="property"/>
<modifiers read="true" write="true" search="true" initial="true" optional="true"/>
<defaultvalue>"noindex,nofollow"</defaultvalue>
<description>Descrizione Robots per indicizzazione pagina prodotto</description>
</attribute>
It seems that the default value declaration does not work since I can't see any values in the backoffice. I'm using SAP Hybris 6.5 version.
Thanks all for any kind of support
You could use an InitiDefaultsInterceptor which will set the Values when you do a
modelService.create(ModelItem.class);
or
ModelItem item = new ModelItem();
modelService.initDefaults(item);
See: https://help.sap.com/docs/SAP_COMMERCE/d0224eca81e249cb821f2cdf45a82ace/8bfbf43e8669101480d0f060d79b... for the whole Life Cycle of a Model.
(The Documentation is for the latest version, but it didn't change since 6.5, so the life cycle is still the same)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
2 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.