cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way yo know the value history of model

Former Member
0 Kudos

Hi Experts I want to know the previous values of the cart model and do necessary logic on it. Is there a way to know abt the same.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Yes there is, try to get history value from ItemModelContext context for e.g. getting old address value from CustomerModel, you can do like this. final ItemModelContextImpl context = (ItemModelContextImpl) customerModel.getItemModelContext(); final ModelValueHistory history = context.getValueHistory(); final AddressModel oldPDA = (AddressModel) history.getOriginalValue(customerModel.PDA);

mpern
Employee
Employee
0 Kudos

If the changes are performed by a business user in the backoffice (or hmc), you could use Saved Values.

But quite frankly, don't use them, they will kill your database.

Another option would be the "Generic Audit" feature (available since 6.6) that snapshots every change to specific item types (configurable)

But again, this generates a lot of entries in you database, especially for such frequently changing items like Carts / CartEntries

Is there any way to implement your requirement / use case using interceptors? or maybe an After Save even? Or, IMHO the best option, add it to the business logic, e.g. CartFacade? This will save you from a lot of headaches in the mid- to long-term.

Former Member
0 Kudos

Could you please send the wiki link for the same.

mpern
Employee
Employee
0 Kudos

Sorry I don't understand, wiki link for what? there are already some links to help.hybris.com in my answer