on 2021 Apr 16 10:11 PM
Hi. I am creating an impex by using DynamicConstraints as below.
INSERT_UPDATE DynamicConstraint;id[unique=true];severity(code,itemtype(code));active;annotation;target;type(code);language(code);message[lang=en];expression
;OnlyOneComponentMayBeDisplayed;ERROR:Severity;true;de.hybris.platform.validation.annotations.Dynamic;my.domain.model.components.CategoryComponentModel;CategoryComponent;BEANSHELL;my message;"cnt = 0; components = getCategory().getComponents(); for(c : components){if (c.isDisplayed()) {cnt++;}} return cnt <= 1;"
And I want to make sure the displayed component is the only one for the category before I save it. This works in java code, but in the DynamicConstraint throws an error message for any Component state (isDisplayed true or false).
Is it possible to do what i want with DynamicConstraint?
Request clarification before answering.
User | Count |
---|---|
13 | |
3 | |
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.