cancel
Showing results for 
Search instead for 
Did you mean: 

ChangeHistory.Read for Contacts - unable to read email address changes

preethi_santhanam
Participant
0 Kudos

Hi All,

I'm trying to read the ChangeHistory for Contacts when the Email address(on header) is changed using the Standard BOs BusinessPartner and BusinessPartnerRelationship.
I've had a look at ChangeHistory.Read in C4C Cloud application Studio example and Event-BeforeSave ABSL - access to UUID but unable to read the the old and new values of the email address.

Code written in Before Save event of BusinessPartner.xbo is:

var UUID = this.GetFirst().UUID;
var change =
ChangeHistory.Read("AP.FO.BusinessPartner.Global:BusinessPartner" ,UUID ); 

Similar code in BeforeSave event of BusinessPartnerRelationship.xbo is:

var UUID = this.GetFirst().UUID;
var change =
ChangeHistory.Read("AP.FO.BusinessPartnerRelationship.Global:BusinessPartnerRelationship" , UUID); 

Is anyone able to guide me please?

Best Regards,
Preethi.

Accepted Solutions (1)

Accepted Solutions (1)

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Preethi,

With the association BusinessPartnerRelationship you are switching from the BO BusinessPartner to the BO BusinessPartnerRelationship. There is no further switch of BO in the rest of the associations.

This means you need to access the BO BusinessPartnerRelationship, not the BusinessPartner.

As your code above looks fine and the SAP coding includes also this BO, it should work.

Please raise an incident on the component AP-RC-BDS-SCR.

Sorry,
. Horst

preethi_santhanam
Participant
0 Kudos

Hello Horst,

Many thanks for your time in looking into this. I shall raise an incident as suggested.

Best Regards,
Preethi.

Answers (1)

Answers (1)

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Preethi,

Did you verify if there are some values for the ChangeHistory like within the normal UI?

Bye,
. Horst

preethi_santhanam
Participant
0 Kudos

Hi Horst,

Thanks for your reply. Yes, all changes are recorded in the Changes tab.

Best Regards,
Preethi.

preethi_santhanam
Participant
0 Kudos

Hi Horst,

Maybe some details on the requirements may help - If the Name/Email address/ Account linked with this Contact changes, we need to send some details to an external system via a web service.Also, is BeforeSave the best event to capture values from ChangeHistory? I see changes made as part of Change1 is retried in the BeforeSave event when I make Change2.

Best Regards,
Preethi.

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Preethi,

Can you tell me the exact element you are looking for? including the path from the Root node?

Reg. "BeforeSave" it is the latest available event you can get.

Bye,
. Horst

preethi_santhanam
Participant
0 Kudos

Hi Horst,

I am looking for the Email element on the Header of a Contact. The Path is AP/FO/BusinessPartner/Global-Root-.CurrentDefaultIsContactPersonFor-.BusinessPartnerRelationship-.ContactPerson-.ContactPersonWorkplaceAddressInformation-.ContactPersonWorkplaceAddress-.DefaultEMail-~URI-~content . Hope this is what you're looking for.

Thanks confirming about the BeforeSave event.

Best Regards,
Preethi Santhanam