cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

how to set model as default value in items.xml using service bean

Former Member
0 Likes
2,134

I have to redefine an OOTB item as catalog version aware and would like to provide default value for the mandatory catalog version field.

Is there a way to inject the default value, a bit like

 <attributes>
     <attribute qualifier="systemVersion" type="ClassificationSystemVersion">
         <modifiers optional="false" unique="true"/>
         <persistence type="property"/>
         <defaultvalue>catalogVersionService.getCatalogVersion("catalogName", "1.0")</defaultvalue>
     </attribute>
 </attributes>


Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Likes

Hi Shubham,

You can try this-

((de.hybris.platform.catalog.CatalogVersionService) de.hybris.platform.core.Registry.getApplicationContext().getBean("catalogVersionService")).getCatalogVersion("catalogName","1.0")

Another approach could be using InitDefaultsInterceptor, I hope you have already considered it.

Thanks,

Former Member
0 Likes

Yes, I have considered the interceptor.

Although, I wanted to know if there is a way to do it via the items definition.

I tried a few things before posting here. Thanks for the response.. I will try it out