Access to activity which triggered marketing automation task

Tom Troughton asked on April 8, 2015 11:59

I'm writing a custom marketing automation action which will be triggered by submission of a bizform. My action class can implement CMS.OnlineMarketing.ContactAutomationAction in order to access the contact details from my Execute() method, but I'd also like to access the content of the submitted form.

Can anyone suggest the best approach?

I know activities have ActivityItemID and ActivityItemDetailID properties which would allow me to access the form data, but I can't see the best way to access the details of the activity which triggered the automation task.

Edit

I've just discovered the LastActivity property of ContactInfo which might be what I'm looking for. But given the asynchronous nature of marketing automation, can I be confident that this will always hold the bizform submission activity (assuming the only trigger is a bizform submission)?

Correct Answer

Brian McKeiver answered on April 13, 2015 01:29

You are correct on the LastActivity property. Check out the bottom of my blog post on Kentico Marketing Automation I talk about it a bit.

If you don't mind dropping into the code though, the best thing to do would be to use a Trigger Event Handler. That way you could set the fom submission data as a macro source and know for sure.

1 votesVote for this answer Unmark Correct answer

Recent Answers


Tom Troughton answered on April 13, 2015 11:32

Thanks Brian, this is really helpful.

0 votesVote for this answer Mark as a Correct answer

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