cancel
Showing results for 
Search instead for 
Did you mean: 

Tracking the old field value in Business Objects Event Handler

Former Member
0 Kudos

Hello Community,

in order to define some smart tracking change actions on some of the Cloud for Customers Entities (like the Accounts and the Contacts), we defined a new implementation of the BeforeSave Event Handler on an Extension for the C4C Business Object BusinessPartner.

Suppose that the BeforeSave Event Handler has been triggered by a change on the Account Name (or any Common Data). In this case, is it possible to acquire (in the event handler ABSL code) both the Old and the New value for the changed fields?

As far as we check the BO data on the Event Handler code, it seems that just the updated values are visible, and that the old ones are lost. Could you please confirm this behavior or suggest any work-around (if present)?

Thanks a lot,

Davide

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

No, this is not possible.

What you have to do, is the following (for each field you are interested in):

1, store the last saved value in a custom field

2. upon save, compare the current value with the last saved value.

if there is a change:

3. Run your custom code

4. restart with 1.

Best regards,

Ludger

Answers (1)

Answers (1)

Former Member
0 Kudos

Another approach would be creating a new custom BO called "Logger" or something like that. 🙂

Then you can store all the changes there and query when required.

Former Member
0 Kudos

Yes, we tought about a similar solution. I'll prepare a mock-up and let you all know.

Kind regards,

Davide

Former Member
0 Kudos


Thank you Fernando,

we realized a little logic where the initial value of a field is tracked with a Change Log Business Object.

Then, everytime the BeforeSave Event Handler is called, the current value is compared with the latest value in the Change Log entries list. If it is different, a new value is stored. The final effect of the Change Log is shown in the picture below:

In the next days we will probably upload a blog article on the solution built.

Kind regards,

Davide

Former Member
0 Kudos

Thank you and ,

We are happy to inform you that we published a blog article regarding the solution discussed above:

Please let us know your opinion in the comments below the article.

Cheers,

Davide