on 10-15-2019 3:19 PM
Hello,
We are facing an issue with the SAP Commerce 1905 related to some Validator Interceptor. The exception that is thrown by those interceptors is not being displayed properly in Backoffice notification widget. Instead of that, a generic error message "Unable to Update" or "Unable to Create" is displayed.
When I was working on another project that was using SAP Commerce 6.7, it was not happening. Do you have any ideas about what changed, or how can I display my custom interceptor messages in Backoffice again?
Thanks!
Hello,
When a ModelSavingException occurs within the Backoffice, eventually a NotificationEvent is published via the OOTB NotificationService. The messages for each NotificationEvent can be configured from within the -backoffice-config.xml files in each backoffice extension.
The default messages for all models' creation, update, removal, etc. are part of the platformbackoffice extension, therefore part of the platformbackoffice-backoffice-config.xml.
For example, the notification for failed update of a model is defined as follows:
<na:notifications eventType="UpdateObject" level="FAILURE">
<na:message>user.notification.items.unable_to_update</na:message>
<!-- Expected map in form object -> exception -->
<na:references linksEnabled="true">
<na:reference placeholder="0"
label="#root.size() == 1 ? (@labelService.getObjectLabel(#root.keySet().iterator().next()) + ' | ' + @exceptionTranslationService.toString(#root.values().iterator().next())) : #root.size()"
message="#root.keySet().iterator().next()" link="#root.size() == 1"/>
</na:references>
</na:notifications>
Since the definition above seems to be the same for both SAP Commerce 6.7 and SAP Commerce 19.05, my guess would be that the implementation of the ExceptionTranslationService.toString() method has been changed after version 6.7.
That being said, in order to change the message shown in the Backoffice, there are a few possible options, including but not limited to:
P.S. Although this is an old question, there seem to be people who face the same issue, therefore the answer.
BR,
Kremena
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kremena,
Thank you for your response. I found below link in documentation. But not able to find backoffice-core-spring.xml and bean definition for defaultExceptionTranslationService in 1905. Is there any way to enable it .
I can see exception is shown my logs but same is not shown on notification area of backoffice. Same is working for me in 1808.
sample log
Caused by: de.hybris.platform.servicelayer.interceptor.impl.MandatoryAttributesValidator$MissingMandatoryAttributesException: [de.hybris.platform.servicelayer.interceptor.impl.MandatoryAttributesValidator@16940d83]:missing values for [brandCategoryID, brandLogo, brandName] in model configuratorModel (<unsaved>) to create a new Configurator INFO | jvm 1 | main | 2020/07/14 13:06:54.054 | at de.hybris.platform.servicelayer.interceptor.impl.MandatoryAttributesValidator.onValidate(MandatoryAttributesValidator.java:104) ~[coreserver.jar:?] INFO | jvm 1 | main | 2020/07/14 13:06:54.055 | at de.hybris.platform.servicelayer.internal.model.impl.wrapper.ModelWrapper.invokeValidateInterceptors(ModelWrapper.java:296) ~[coreserver.jar:?] INFO | jvm 1 | main | 2020/07/14 13:06:54.055 | at
Regards,
Amrita
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Amrita,
As it is mentioned in the documentation you found, the defaultExceptionTranslationService is defined in the backoffice-core-spring.xml. You should be able to find it within the /hybris folder. If you want to extend the service and redefine the bean, you should do so in your custom extension.
BR,
Kremena
User | Count |
---|---|
5 | |
1 | |
1 | |
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.