# Create a workflow that gets event details

**URL:** <https://community.dynatrace.com/t/create-a-workflow-that-gets-event-details/40178>\
**Category:** Automations\
**Tags:** latest-dynatrace, workflows, events, javascript\
**Created:** [June 13, 2023, 8:54am UTC](https://community.dynatrace.com/t/create-a-workflow-that-gets-event-details/40178 "2023-06-13T08:54:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Duran\_Narbona](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/duran_narbona/32/22405_2.png) [@Duran\_Narbona](https://community.dynatrace.com/u/Duran_Narbona)\
**Post date:** [June 13, 2023, 8:54am UTC](https://community.dynatrace.com/t/create-a-workflow-that-gets-event-details/40178/1 "2023-06-13T08:54:35Z")

</div>

I am creating a workflow that gets event details. It’s very simple, here is the diagram and this is the code:

**Simplified coding:**

```javascript
import { problemsClient } from '@dynatrace-sdk/client-classic-environment-v2';

export default async function ({ execution_id }) {
// get event context
var exec_req = await fetch(`/platform/automation/v0.1/executions/${execution_id}`)
var execution_obj = await exec_req.json()

return execution_obj
}

```

**Advanced coding:**

```javascript
import { problemsClient } from '@dynatrace-sdk/client-classic-environment-v2';

export default async function ({ execution_id }) {
    // get event context
    var exec_req = await fetch(`/platform/automation/v0.1/executions/${execution_id}`)
    var execution_obj = await exec_req.json()

    // get problem
    console.log("Loading Problem details...")
    var event = execution_obj.params.event
    var problem_request = { problemId: event['display_id'] }
    var problem = await problemsClient.getProblem(problem_request)
    console.log(`Problem ${problem.displayId}`)

    return problem
}

```

As an example, I have looked at an image you have posted on the Dynatrace website, because in the documentation I can’t find anything about how to capture these events from a workflow.

My problem is that even though the **execution\_id** &nbsp;of the previous run gets it right, then it tells me that the object is empty --\>&nbsp; **execution\_obj.params**

Could someone help me with this issue? where is there documentation on this issue and how to process a previous event? Thank you very much

**Bonus:** I tested with this code example, adding the event id by hand, and it works perfectly.

```javascript
import { problemsClient } from '@dynatrace-sdk/client-classic-environment-v2';

export default async function ({ execution_id }) {
    // get problem
    console.log("Loading Problem details...")
    var problem_id = "-123456789V2"
    var problem_request = {problemId: problem_id}
    var problem = await problemsClient.getProblem(problem_request)
    console.log(`Problem ${problem.displayId}`)

    return problem
}

```

 ![Screenshot 2023-06-13 at 10.16.22.png](https://global.discourse-cdn.com/dynatrace/original/2X/1/154eddcbd2a43bd91b4eb6ea98f474fd02fed3a2.png)  
 ![Screenshot 2023-06-09 at 13.28.47.jpg](https://global.discourse-cdn.com/dynatrace/original/2X/1/1c002c0ad06c2677cc8430402911a5ddf919514f.jpeg)

---

<div class="post-metadata">

**Author:** ![Duran\_Narbona](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/duran_narbona/32/22405_2.png) [@Duran\_Narbona](https://community.dynatrace.com/u/Duran_Narbona)\
**Post date:** [June 14, 2023, 11:20am UTC](https://community.dynatrace.com/t/create-a-workflow-that-gets-event-details/40178/2 "2023-06-14T11:20:56Z")

</div>

Is working:

```javascript
var exec_req = await fetch(`/platform/automation/v1/executions/${execution_id}`)

```

the version is **v1**

---

<div class="post-metadata">

**Author:** ![Duran\_Narbona](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/duran_narbona/32/22405_2.png) [@Duran\_Narbona](https://community.dynatrace.com/u/Duran_Narbona)\
**Post date:** [June 16, 2023, 11:27am UTC](https://community.dynatrace.com/t/create-a-workflow-that-gets-event-details/40178/3 "2023-06-16T11:27:04Z")

</div>

Typo:

```javascript
var problem_request = { problemId: event['event.id'] }

```
