on 10-01-2018 2:49 PM
How to set default value in config xml? I have such code. Here I created new product, set enum that is needed. But the next step does not work. I could simply initialize object by String, but I need to do it throught method because on the next stages I will need to return complex object by method.
<wz:prepare id="productPrepare">
<wz:initialize property="newProduct"
type="Product"/>
<wz:assign property="newProduct.approvalStatus"
value="T(de.hybris.platform.catalog.enums.ArticleApprovalStatus).APPROVED"/>
<wz:assign property="newProduct.rating"
value="T(com.epam.training.controller.CatalogVersionCreator).getFive()"/>
</wz:prepare>
To access enums, you can use the enumerationService
via a SpEL expression (wrapped in {}
😞
<wz:assign property="newProduct.approvalStatus"
value="{@enumerationService.getEnumerationValue('ArticleApprovalStatus','approved')}"/>
EDIT
You can use SpEL throughout the backoffice, as long as the expression is wrapped in {}
, for example:
{1 + 1}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
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.