Custom Action Class in Marketing Automation - Contact Activity question

David Pearson asked on September 22, 2016 18:59

I have a custom action class that inherits ContactAutomationAction. This action triggers when the activity Purchase is created for the Contact.
In the override Execute() I get the Contact object then I get the Contact.LastActivity value. If the LastActivity value is “purchase” the code will sent out email using a template from Kentico API.

Problem: If the Contact(aka user) moves to another page the LastActivity value will never be “purchase”.

Question: How do I get the Purchase Activity that trigger the Action in Steps from Kentico. I was thinking the last Purchase activity, but the User could went back in order during the 5 day delay in steps.

Correct Answer

David Pearson answered on September 22, 2016 21:41

I ended up with this solution here. Does anyone have a better one?

var lastPurchaseActivity = ActivityInfoProvider.GetContactsLastActivity(Contact.ContactID, "Purchase");

Thanks David

0 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.