Can I use data from a workflow trigger event in a custom coded action?

I am trying to find a way to easily track engagement, for example email opens, separately between our two business units. I am wondering if using a custom coded action might be a way to do this. If I use an event trigger for a contact workflow of “opened email”, I can see in the enrollment diagnosis all the information of the email which was opened and caused the workflow to trigger, including the business unit of the email. See screenshots:


Showing the “opened email” event occurred.

Showing the Business Unit is included in the data given.

What I want to know is if this information from the trigger step can subsequently be used/called in a custom coded action?

If so I would be able to identify the business unit of the email which triggered the workflow and use that to help me fill custom properties I would create that could essentially be like the Hubspot default “last marketing email open date” but specified to each business unit. That way I would know the last date an email from business unit 1 was opened as well as the last date an email from business unit 2 was opened. Any other ideas on how to track this would also be helpful. Thanks!

You can add properties to the workflow and then use them. See Workflows | Custom Code Actions - HubSpot docs

@dsmarion, it looks like this only allows you to add properties that exist on the record enrolled in the workflow or from previous actions. We need a way to access properties/values from the trigger event.

@dsmarion Thank you for taking the time to respond. However, @JTBuys is correct. I have already looked at the properties you mention and they are all properties of the contact record that was enrolled in the workflow. What I need is to access a property from the marketing email which triggered the contact record to enroll in the first place.

Hmmm… I wonder if you can use the contact email and then in your coded action make a call to the email events endpoint and get that data: https://legacydocs.hubspot.com/docs/methods/email/get_events (the newer version of this is not released yet it looks like)

You can also use event properties: