# Workflows access data from another workflow step

**URL:** <https://community.dynatrace.com/t/workflows-access-data-from-another-workflow-step/50706>\
**Category:** Automations\
**Tags:** workflows\
**Created:** [March 13, 2025, 3:19pm UTC](https://community.dynatrace.com/t/workflows-access-data-from-another-workflow-step/50706 "2025-03-13T15:19:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vitz](https://avatars.discourse-cdn.com/v4/letter/v/9fc29f/32.png) [@vitz](https://community.dynatrace.com/u/vitz)\
**Post date:** [March 13, 2025, 3:19pm UTC](https://community.dynatrace.com/t/workflows-access-data-from-another-workflow-step/50706/1 "2025-03-13T15:19:22Z")

</div>

Hi folks,

I need help in writing some JS code for a workflow.

In a previous step i have a HTTP API request the pulls data and returns the payload in JSON. the step name is “sn\_step1”

{&nbsp; &nbsp; “result”: [&nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; “state”: “test\_state\_1”,&nbsp; &nbsp; &nbsp; &nbsp; “number”: “1234567”,&nbsp; &nbsp; &nbsp; &nbsp; “end\_date”: “2025-02-28 09:12:19”,&nbsp; &nbsp; &nbsp; &nbsp; “start\_date”: “2025-02-27 09:30:15”,&nbsp; &nbsp; &nbsp; &nbsp; “short\_description”: “Test 1”&nbsp; &nbsp; &nbsp; },&nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; “state”: “test\_state\_2”,&nbsp; &nbsp; &nbsp; &nbsp; “number”: “1234567”,&nbsp; &nbsp; &nbsp; &nbsp; “end\_date”: “2025-02-28 09:12:19”,&nbsp; &nbsp; &nbsp; &nbsp; “start\_date”: “2025-02-27 09:30:15”,&nbsp; &nbsp; &nbsp; &nbsp; “short\_description”: “Test 2”&nbsp; &nbsp; &nbsp; }&nbsp; &nbsp;]&nbsp; }I need to use number, start\_date, end\_date values in variables in a downstream step.&nbsp;Sample code

// import of sdk modules  
import { execution } from ‘@dynatrace-sdk/automation-utils’;

export default async function ({ execution\_id }) {  
const exe = await execution(execution\_id);  
const checkResult = await exe.result(‘sn\_step1’);

const Scope = data[0].json.scope;  
return Scope;

console.log(Scope);

im just trying to log the output in this step to see if i can pull in the json output from previous step

---

<div class="post-metadata">

**Author:** ![ChristopherHejl](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/christopherhejl/32/20735_2.png) [@ChristopherHejl](https://community.dynatrace.com/u/ChristopherHejl)\
**Post date:** [March 13, 2025, 3:50pm UTC](https://community.dynatrace.com/t/workflows-access-data-from-another-workflow-step/50706/2 "2025-03-13T15:50:39Z")

</div>

Almost there. You now have the result data in “checkResult”. Here is my example code based on your data. I’ve also attached the whole example workflow which you can upload in the workflows app (upload button next to create workflow,&nbsp; just upload the json file in the zip):

```javascript
import { execution } from '@dynatrace-sdk/automation-utils';

export default async function ({ executionId }) {

  const exe = await execution(executionId);
  const checkResult = await exe.result('sn_step1');

  console.log("This is the full result object")
  console.log(checkResult)
  console.log("===============================")

  const firstItem = checkResult[0]

  console.log("This is the first item of the list")
  console.log(firstItem)
  console.log("===============================")

  console.log("This is the number of the first item of the list")
  console.log(firstItem.number)
  console.log("===============================")

}

```

 ![ChristopherHejl_0-1741880818898.png](https://global.discourse-cdn.com/dynatrace/original/3X/7/b/7bc7e01e2b81de7c7fd3ec3f796bfca8dee466d8.png)  
[wf\_data\_access\_in\_javascript\_example.zip](https://community.dynatrace.com/uploads/short-url/AgllwjlnXSRdMwA7FUZE0qsZGqq.zip) (1 KB)

---

<div class="post-metadata">

**Author:** ![vitz](https://avatars.discourse-cdn.com/v4/letter/v/9fc29f/32.png) [@vitz](https://community.dynatrace.com/u/vitz)\
**Post date:** [March 13, 2025, 4:07pm UTC](https://community.dynatrace.com/t/workflows-access-data-from-another-workflow-step/50706/3 "2025-03-13T16:07:13Z")

</div>

Thanks this is what I was looking for
