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

**URL:** <https://community.hubspot.com/t/can-i-use-data-from-a-workflow-trigger-event-in-a-custom-coded-action/100603>\
**Category:** APIs & Integrations\
**Tags:** workflows\
**Created:** [February 21, 2024, 1:02am UTC](https://community.hubspot.com/t/can-i-use-data-from-a-workflow-trigger-event-in-a-custom-coded-action/100603 "2024-02-21T01:02:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![swise](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@swise](https://community.hubspot.com/u/swise)\
**Post date:** [February 21, 2024, 1:02am UTC](https://community.hubspot.com/t/can-i-use-data-from-a-workflow-trigger-event-in-a-custom-coded-action/100603/1 "2024-02-21T01:02:48Z")

</div>

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:

 ![Screenshot 2024-02-20 at 4.47.54 PM.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/a/3/a31935313b8b131014acb47df771370580019a6b.png)  
Showing the “opened email” event occurred.  
 ![Screenshot 2024-02-20 at 4.48.19 PM.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/c/b/cbb89693a0e51cda1db66bb5eb79d5243b419926.png)  
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!

---

<div class="post-metadata">

**Author:** ![dsmarion](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dsmarion/32/7509_2.png) [@dsmarion](https://community.hubspot.com/u/dsmarion)\
**Post date:** [February 22, 2024, 1:51pm UTC](https://community.hubspot.com/t/can-i-use-data-from-a-workflow-trigger-event-in-a-custom-coded-action/100603/2 "2024-02-22T13:51:11Z")

</div>

You can add properties to the workflow and then use them. See [Workflows | Custom Code Actions - HubSpot docs](https://developers.hubspot.com/docs/api/workflows/custom-code-actions)

 ![dsmarion_0-1708609826453.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/9/0/90cc2c4965ac028b53273408e356f30c28a67b35.png)

---

<div class="post-metadata">

**Author:** ![JTBuys](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jtbuys/32/62318_2.png) [@JTBuys](https://community.hubspot.com/u/JTBuys)\
**Post date:** [February 22, 2024, 2:11pm UTC](https://community.hubspot.com/t/can-i-use-data-from-a-workflow-trigger-event-in-a-custom-coded-action/100603/3 "2024-02-22T14:11:01Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![swise](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@swise](https://community.hubspot.com/u/swise)\
**Post date:** [February 22, 2024, 4:59pm UTC](https://community.hubspot.com/t/can-i-use-data-from-a-workflow-trigger-event-in-a-custom-coded-action/100603/4 "2024-02-22T16:59:48Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![dsmarion](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dsmarion/32/7509_2.png) [@dsmarion](https://community.hubspot.com/u/dsmarion)\
**Post date:** [February 22, 2024, 5:37pm UTC](https://community.hubspot.com/t/can-i-use-data-from-a-workflow-trigger-event-in-a-custom-coded-action/100603/5 "2024-02-22T17:37:22Z")

</div>

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](https://legacydocs.hubspot.com/docs/methods/email/get_events) (the newer version of this is not released yet it looks like)

---

<div class="post-metadata">

**Author:** ![dsmarion](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dsmarion/32/7509_2.png) [@dsmarion](https://community.hubspot.com/u/dsmarion)\
**Post date:** [February 22, 2024, 2:10pm UTC](https://community.hubspot.com/t/can-i-use-data-from-a-workflow-trigger-event-in-a-custom-coded-action/100603/6 "2024-02-22T14:10:20Z")

</div>

You can also use event properties:
