# how to pass problem values to payload for API integration

**URL:** <https://community.dynatrace.com/t/how-to-pass-problem-values-to-payload-for-api-integration/48783>\
**Category:** Automations\
**Tags:** workflows, automations\
**Created:** [November 7, 2024, 1:10pm UTC](https://community.dynatrace.com/t/how-to-pass-problem-values-to-payload-for-api-integration/48783 "2024-11-07T13:10:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![siddharth](https://avatars.discourse-cdn.com/v4/letter/s/f19dbf/32.png) [@siddharth](https://community.dynatrace.com/u/siddharth)\
**Post date:** [November 7, 2024, 1:10pm UTC](https://community.dynatrace.com/t/how-to-pass-problem-values-to-payload-for-api-integration/48783/1 "2024-11-07T13:10:43Z")

</div>

Hi World ,

I want to create a workflow that will send problem details in JSON payload to another API.&nbsp; I tried this in payload

“ImpactedEntities”: {Stage}

but it is printing stage instead of picking value in variable stage .

I tried with and without double quotes

---

<div class="post-metadata">

**Author:** ![PacoPorro](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/pacoporro/32/36087_2.png) [@PacoPorro](https://community.dynatrace.com/u/PacoPorro)\
**Post date:** [November 7, 2024, 1:51pm UTC](https://community.dynatrace.com/t/how-to-pass-problem-values-to-payload-for-api-integration/48783/2 "2024-11-07T13:51:15Z")

</div>

Try with

```auto
"ImpactedEntities": {{ Stage }}

```

---

<div class="post-metadata">

**Author:** ![siddharth](https://avatars.discourse-cdn.com/v4/letter/s/f19dbf/32.png) [@siddharth](https://community.dynatrace.com/u/siddharth)\
**Post date:** [November 7, 2024, 3:24pm UTC](https://community.dynatrace.com/t/how-to-pass-problem-values-to-payload-for-api-integration/48783/3 "2024-11-07T15:24:41Z")

</div>

Nope Not working on the other hand it is stating it is the wrong variable

I think this is the solution&nbsp;[Jinja expressions for Workflows — Dynatrace Docs](https://docs.dynatrace.com/docs/platform-modules/automations/workflows/reference#any-object)

so for accessing last stage data, I am using event

{{ event()[‘event.category’] }}

---

<div class="post-metadata">

**Author:** ![siddharth](https://avatars.discourse-cdn.com/v4/letter/s/f19dbf/32.png) [@siddharth](https://community.dynatrace.com/u/siddharth)\
**Post date:** [November 11, 2024, 11:42am UTC](https://community.dynatrace.com/t/how-to-pass-problem-values-to-payload-for-api-integration/48783/4 "2024-11-11T11:42:16Z")

</div>

So finally I was able to make a payload and this is how it looks

```markup
{
"ImpactedEntities" : [{ 
  "type" : "{{ event('affected_entity_types') }} " , 
  "name" : "{{ event('affected_entity_ids') }}" ,
  "entity" : "{{ event('affected_entity_ids' ) }}"
  } ],
 "ImpactedEntity" :{ 
  "type" : "{{ event('affected_entity_types') | first }}" , 
  "name" : "{{ event('affected_entity_ids') | first }}" ,
  "entity" : "{{ event('affected_entity_ids') | first }}"
  },
  "PID" :"{{ event()['event.id'] }}" ,
  "ProblemID" : "{{ event('display_id') }}" ,
  "ProblemTitle" : "{{ event()['event.name'] | replace('\n', ' ') | replace('**', '') | replace('# ', '') }}" ,
  "ProblemDetailsText" : "{{ event()['event.description'] | replace('\n', ' ') | replace('**', '') | replace('# ', '') }}" ,
  "ProblemURL" : "https://{environmentid}.apps.dynatrace.com/ui/apps/dynatrace.davis.problems/problem/{{ event()['event.id'] }}" ,
  "ProblemSeverity" : "{{ event()['event.category'] }}" ,
  "State" : "{{ event()['event.status'] }}" ,
  "tags" : {{ event().get('entity_tags','[]') | to_json }} ,
  "ProblemDetailsJSONv2": {
    "description": "{{ event()['event.description'] | replace('\n', ' ') | replace('**', '') | replace('# ', '') }}",
    "title": "{{ event()['event.name'] | replace('\n', ' ') | replace('**', '') | replace('# ', '') }}",
    "pid": "{{ event()['event.id'] }}",
    "display_id": "{{ event('display_id') }}"
  }
}

```
