# Getting the record being updated

**URL:** <https://community.forestadmin.com/t/getting-the-record-being-updated/6474>\
**Category:** Help me!\
**Tags:** howtos, smart-action\
**Created:** [July 9, 2023, 7:46pm UTC](https://community.forestadmin.com/t/getting-the-record-being-updated/6474 "2023-07-09T19:46:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![genzo](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/genzo/32/6279_2.png) [@genzo](https://community.forestadmin.com/u/genzo)\
**Post date:** [July 9, 2023, 7:46pm UTC](https://community.forestadmin.com/t/getting-the-record-being-updated/6474/1 "2023-07-09T19:46:07Z")

</div>

Hello, I am using the forest admin with nodejs and nestjs with a postgres db.

I would like to get the current record being updating using the before (or after) update hook.  
I could see that I can get all the records in the collection using the context.collection where the collection is the argument of the callback function, but I’m only interested (and required) to get the actual record being updated.  
I’ve tried all the methods of the context and none of them seemed to work, any idea on what I should do?

---

<div class="post-metadata">

**Author:** ![anon39940173](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@anon39940173](https://community.forestadmin.com/u/anon39940173)\
**Post date:** [July 9, 2023, 7:58pm UTC](https://community.forestadmin.com/t/getting-the-record-being-updated/6474/2 "2023-07-09T19:58:48Z")

</div>

Hello @genzo  
Welcome to the forest admin community

You may use:

```javascript
const records = await context.collection.list(
  context.filter,
  ['the', 'fields', 'you', 'need']
);

```

Note: you may check the following API reference for information, but if you are using a modern IDE, autocompletion should work everywhere

> **[@forestadmin/datasource-customizer | Forest Admin - API reference](https://forestadmin.github.io/agent-nodejs/modules/_forestadmin_datasource_customizer.html)**
>
> Documentation for Forest Admin - API reference

---

<div class="post-metadata">

**Author:** ![genzo](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/genzo/32/6279_2.png) [@genzo](https://community.forestadmin.com/u/genzo)\
**Post date:** [July 9, 2023, 9:06pm UTC](https://community.forestadmin.com/t/getting-the-record-being-updated/6474/3 "2023-07-09T21:06:48Z")

</div>

Exactly what I wanted, thanks!
