# Referencing data in JavaScript in filter

**URL:** <https://connective.celigo.com/t/referencing-data-in-javascript-in-filter/1249>\
**Category:** Integration Apps\
**Tags:** hooks, filter, json, javascript\
**Created:** [December 15, 2020, 11:01pm UTC](https://connective.celigo.com/t/referencing-data-in-javascript-in-filter/1249 "2020-12-15T23:01:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamesk](https://avatars.discourse-cdn.com/v4/letter/j/54ee81/32.png) [@jamesk](https://connective.celigo.com/u/jamesk)\
**Post date:** [December 15, 2020, 11:01pm UTC](https://connective.celigo.com/t/referencing-data-in-javascript-in-filter/1249/1 "2020-12-15T23:01:09Z")

</div>

Hello Community,

I need to filter based upon some more involved string parsing that is awkward for the point and click filter, but which JavaScript can handle easily. However, I cannot find examples as far as referencing the passed in JSON data. For other hooks, such as pre-map, there is the _options.data[].fieldname_ format with _function premap(options)_ syntax. In the filter, the object is "record" instead of data. I have tried, for example:

_function filter (options) with options.record[0].amount, record[0].amount, record.amount,_ and just "_amount"_

I have also tried "data" instead of record, and tried using "record" as the passed in parameter.

Unlike the other J-Hook locations, this one does not offer a stub, which would be helpful.

Thank you for any insight into how to reference these data fields.

Jim

---

<div class="post-metadata">

**Author:** ![viliandyleonardo](https://avatars.discourse-cdn.com/v4/letter/v/839c29/32.png) [@viliandyleonardo](https://connective.celigo.com/u/viliandyleonardo)\
**Post date:** [March 18, 2021, 10:49pm UTC](https://connective.celigo.com/t/referencing-data-in-javascript-in-filter/1249/2 "2021-03-18T22:49:03Z")

</div>

@jamesk

Hi James,

Apology for a late reply. As a side note, in the future you may want to post this type of question that is not a connector specific in this [space](https://connective.celigo.com/c/6) for more visibility.

On the left pane, you can navigate to Scripts by way of "Resources -\> Scripts". Then on the Scripts page, you can create a new script, then choose insert function stub "filter". When you have created and saved the filter, you can choose this filter script when you are defining filter using javascript option.

Here is the screenshot of creating a filter with stub filter

 ![5301043caa20740200000001-fd4413fa2a9647e7922167569a9ada06.png](https://us1.discourse-cdn.com/flex001/uploads/celigo/original/2X/e/e795243d7841d80adf182f415fe4cbb6b8020b9b.png)
