Answer the question
In order to leave comments, you need to log in
How to find out which fields were changed when the OnAfterIBlockSectionUpdate event was called?
The task is to perform some actions when changing the infoblock section, only if its name has been changed. I know that it is possible to save the state when the OnBeforeIBlockSectionUpdate event is called. Is there an alternative?
Answer the question
In order to leave comments, you need to log in
You don't need to save anything.
When the OnBeforeIBlockSectionUpdate event fires, get the fields (from the parameters of the handler function). These are new values. You already know how to get the old ones: CIBlockSection::GetByID().
It turns out that your task is reduced to a banal condition in the handler:
$oldFields = \CIBlockSection::GetByID($fields["ID"])->GetNext();
if($fields["NAME"] != $oldFields["NAME"]) {...}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question