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

Get product model in custom constraint

former_member196079
Active Contributor
0 Likes
421

Hi experts

i need to create some constraints and check product description based some product attribute (in product cockpit).

For example: if product catalog is X and category Y check if description in EN is not null.

i've created a new custom constraint, but i'm not able to get the product model to read the product attributes. To Create the custom contraint i've followed this link.

https://help.sap.com/viewer/d97b2ab46fde43a78640036ebf68e106/v2005/en-US/c2f5088646aa40f78dc41890404...

Any help?any suggestion?

Thanks Marco

Accepted Solutions (0)

Answers (2)

Answers (2)

arwez
Explorer
0 Likes

The first thing that comes to mind is that this example uses an AttributeConstraint but you seem to need a TypeConstraint if that wasn't clear.

If your ConstraintValidator uses the correct type parameters, then the "isValid" method should provide the productModel as an attribute. Could it be that you simply copied:

ConstraintValidator<NotLoremIpsum,String>

Instead of using smth like the following?

ConstraintValidator<NotLoremIpsum,ProductModel>
former_member196079
Active Contributor
0 Likes

anyone can help me?