on 2019 Jan 29 12:23 PM
Hi,
As part of the business, I want to track all modified attributes(Dirty attributes) and its values when data imported through HAC same like HMC or Backoffice will do.
Request clarification before answering.
You can use ModelContextUtils.getItemModelContext(yourModel).getDirtyAttributes() e.g. by executing the following code in groovy console of hAC, you should be able to find all dirty attributes of the given model:
import de.hybris.platform.servicelayer.model.ModelContextUtils
exampleProduct = modelService.create('Product')
exampleProduct.code = "12345"
exampleProduct.catalogVersion = catalogVersionService.getCatalogVersion('Default', 'Staged')
try {
p = flexibleSearchService.getModelByExample exampleProduct
} catch (e) {
p = exampleProduct
}
ModelContextUtils.getItemModelContext(p).getDirtyAttributes()
You can also check my answer to a similar problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank You for the response.
But that is not I am expecting. Whenever the data imported by the user from HAC those changes should be saved in SavedValues table and at the same time, those changes should be reflected on the back-office modified changes tab.
Hello,
I think you are looking for Interceptors, here are some articles explaining that and how to implement them :
http://javainsimpleway.com/interceptors-in-hybris/
http://javainsimpleway.com/implementing-interceptor-in-hybris/
KR,
Youssef
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
a simple solution would be as follows:
yourmodel.getItemModelContext().getDirtyAttributes() to get the dirty attributes.
or if you just want to check if it has dirty attributes:
yourmodel.getItemModelContext().isDirty()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 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.