# Directus Flow Response Manipulation

**URL:** <https://community.directus.com/t/directus-flow-response-manipulation/989>\
**Category:** Help\
**Tags:** flows\
**Created:** [August 18, 2025, 5:11pm UTC](https://community.directus.com/t/directus-flow-response-manipulation/989 "2025-08-18T17:11:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anton](https://sea2.discourse-cdn.com/flex002/user_avatar/community.directus.com/anton/32/767_2.png) [@Anton](https://community.directus.com/u/Anton)\
**Post date:** [August 18, 2025, 5:11pm UTC](https://community.directus.com/t/directus-flow-response-manipulation/989/1 "2025-08-18T17:11:27Z")

</div>

How can I use Directus Flows to manipulate certain fields when creating an item, supplement them with data from my Directus, and then return this supplemented data to the application in the response body?

Of course, the same object should also be created in Directus at the same time.

**What I tried:**

I have an event hook (item.create) triggering my flow and a Transform Payload operation at the end of the chain, looking like that:

{  
“name”: “{{item\_read\_gejrb[0].first\_name}} {{item\_read\_gejrb[0].last\_name}}”,  
“image\_external”: “{{item\_read\_gejrb[0].avatar\_url}}”,  
“layer”: “{{$trigger.payload.layer}}”,  
“position”: “{{$trigger.payload.position}}”,  
“id”: “{{$trigger.payload.id}}”  
}

**Result:**

An empty item is created. Missing all the fields provided. It just exist user\_created, date\_created and id (not the one I provided)

**Log:**

 ![image](https://us1.discourse-cdn.com/flex002/uploads/directus/original/1X/76e8fbb087b0ca8756a0777c342db1661466ed1b.png)

---

<div class="post-metadata">

**Author:** ![ahmad\_quvor](https://sea2.discourse-cdn.com/flex002/user_avatar/community.directus.com/ahmad_quvor/32/310_2.png) [@ahmad\_quvor](https://community.directus.com/u/ahmad_quvor)\
**Post date:** [August 18, 2025, 6:32pm UTC](https://community.directus.com/t/directus-flow-response-manipulation/989/2 "2025-08-18T18:32:39Z")

</div>

Hello, Anton

Try to use the script and create a new payload and use that and see if it works.

---

<div class="post-metadata">

**Author:** ![Anton](https://sea2.discourse-cdn.com/flex002/user_avatar/community.directus.com/anton/32/767_2.png) [@Anton](https://community.directus.com/u/Anton)\
**Post date:** [August 18, 2025, 7:02pm UTC](https://community.directus.com/t/directus-flow-response-manipulation/989/3 "2025-08-18T19:02:14Z")

</div>

Thank you very much for your reply! I get exactly the same result with the script.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/directus/original/1X/e9d1ef616071352cf03035b3200bdc2823305bd0.png)

---

<div class="post-metadata">

**Author:** ![Anton](https://sea2.discourse-cdn.com/flex002/user_avatar/community.directus.com/anton/32/767_2.png) [@Anton](https://community.directus.com/u/Anton)\
**Post date:** [August 23, 2025, 2:29pm UTC](https://community.directus.com/t/directus-flow-response-manipulation/989/4 "2025-08-23T14:29:16Z")

</div>

Has someone some idea how I can solve this?

---

<div class="post-metadata">

**Author:** ![Nik](https://avatars.discourse-cdn.com/v4/letter/n/6de8d8/32.png) [@Nik](https://community.directus.com/u/Nik)\
**Post date:** [August 23, 2025, 6:19pm UTC](https://community.directus.com/t/directus-flow-response-manipulation/989/5 "2025-08-23T18:19:38Z")

</div>

Flows are a little tricky and their UX could definitely be improved.

I can’t see @ahmad_quvor script anymore, but basically you want to add the data acquired by previous operations to the original payload that was passed to the flow using a script operation.

```auto
module.exports = async function(data) {
	const payload = data.$trigger.payload;
        payload.name = item_read_gejrb[0].last_name;
        payload.image_external= item_read_gejrb[0].avatar_url;
	return payload;
};

```

The script operation should be the last operation of the chain and the `Response Body` of the flow should be set to `Data of Last Operation`

Make sure that `item_read_gejrb` operation is returning the expected data by inspecting the flow log.

---

<div class="post-metadata">

**Author:** ![Anton](https://sea2.discourse-cdn.com/flex002/user_avatar/community.directus.com/anton/32/767_2.png) [@Anton](https://community.directus.com/u/Anton)\
**Post date:** [August 27, 2025, 7:46am UTC](https://community.directus.com/t/directus-flow-response-manipulation/989/6 "2025-08-27T07:46:45Z")

</div>

Thank you!!

I don’t know, what I did wrong. But now it’s working with a blocking Flow returning the data of the last operation and a custom script which transforms the payload
