Hi All,
I would like to have the contact person details like "Contact Person Name" & "Contact Person Email" in the Customer Extension BO as soon as mutation on the Contact person happens. We use here event "Before Save Event"
The following works when Customer has one Contact person and he is main contact person.
if ( this.CurrentDefaultHasContactPerson.IsSet() ) {
com.ExtCpEmail = this.CurrentDefaultHasContactPerson.BusinessPartnerRelationship.ContactPerson.ContactPersonWorkplaceAddressInformation.AddressSnapshot.DefaultEMail.URI.content;
com.ExtRPnaam = this.CurrentDefaultHasContactPerson.BusinessPartnerRelationship.ContactPerson.ContactPersonWorkplaceAddressInformation.AddressSnapshot.Name.GetFirst().Name.ThirdLineName;
};
Now if a customer already has a default contact person and when we try to add another contact person to it. I have difficulties in getting the details of the Contact person thats being changed .i.e. I could not get hold of the contact person thats in the context.
I used the below to get the contact person being changed or created . When I do a retrieve I get nothing in the email address . Any suggestion on proceeding further ??
var CpCollection = this.HasContactPerson.OrderByDescending(n=>n.RelationshipBusinessPartnerInternalID);
var Cpnr = CpCollection.GetFirst().RelationshipBusinessPartnerInternalID;
var Cpid = CpCollection.GetFirst().RelationshipBusinessPartnerUUID;
var ret = BusinessPartner.Retrieve(Cpid);
var CpEmail = ret.AddressInformation.AddressSnapshot.Email;
var CPEmail2 = ret.AddressSnapshot.Email;
Regards,
Amber