Showing results for 
Search instead for 
Did you mean: 

Validation in product cockpit

0 Kudos

Hi everybody,

I have a question about product cockpit, as of now, I used validator to intercept a approval status change in product cockpit, it will show a validation message in the Editor Area if fail to meet some requirements.

The message will show when user change the value of approval status using the following method

but it won't show the validation message if user uses to change the approval status.

Both method will result in no change in approval status, which is expected, just I am not sure how to make the validation message shown in both methods.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Tony,

You will have to override the setApprovalStatus() method of the exiting ProductServiceImpl class, you could try something like :

 public class MyProductServiceImpl extends ProductServiceImpl
     private static final Logger log = Logger.getLogger(MyProductServiceImpl.class);
     public void setApprovalStatus(final TypedObject item, final String code)
         if (item.getObject() instanceof ProductModel
                 && UISessionUtils
                         .checkAttributePermissionOn(item.getType().getCode(), CatalogConstants.Attributes.Product.APPROVALSTATUS,
             final ItemModel itemModel = (ItemModel) item.getObject();
             final Product product = (Product) TypeTools.getModelService().getSource(itemModel);
             super.setApprovalStatus(item, code);
             final ProductModel productModel = (ProductModel) getModelService().get(product);

Hope that helps.

Cheers, Yves

0 Kudos

Hi Yves,

With the above solution the problem is:

On approval through global approval icon, the approvalstatus icon is not refreshed. Please suggest a way to refresh editor area.