I'm trying to create a new contact and logging activities to that contact. It's currently creating the contact correctly, however it's logging the activity to an anonymous contact. How can I assign the activity to the contact just created? Is it something with the last line of code? Thank you!
ContactInfo currentContact = ContactManagementContext.CurrentContact;
ContactInfo updateContact = ContactInfoProvider.GetContacts()
if (updateContact != null)
// Updates the contact's properties
updateContact.ContactFirstName = txtFirstName.Text;
updateContact.ContactLastName = txtLastName.Text;
// Saves the updated contact to the database
// Creates a new contact object
ContactInfo newContact = new ContactInfo()
ContactLastName = txtLastName.Text,
ContactFirstName = txtFirstName.Text,
ContactEmail = txtEmailAddress.Text,
// Enables activity tracking for the new contact
ContactMonitored = true
// Saves the contact to the database
// Gets an instance of the activity logging service
var service = Service.Resolve<IActivityLogService>();
// Prepares an initializer for logging the activity
var activityInitializer = new Donation("Donation");
// Logs the activity
I think I got it, I pulled the current ID contact I and passed that in here. Sorry, still new to Kentico!
var activityInitializer = new Donation("Donation", contactID);
Please, sign in to be able to submit a new answer.