# Use CRM data in JS

**URL:** <https://community.hubspot.com/t/use-crm-data-in-js/18199>\
**Category:** CMS Development\
**Tags:** javascript\
**Created:** [January 18, 2020, 10:19am UTC](https://community.hubspot.com/t/use-crm-data-in-js/18199 "2020-01-18T10:19:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tommitchell](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tommitchell/32/44643_2.png) [@tommitchell](https://community.hubspot.com/u/tommitchell)\
**Post date:** [January 18, 2020, 10:19am UTC](https://community.hubspot.com/t/use-crm-data-in-js/18199/1 "2020-01-18T10:19:59Z")

</div>

Hi - sorry if this is a daft question but I’m trying to work out how to use contact CRM data in the js part of a custom module.

This is a data series for a chart:

series: [{  
name: ‘sales’,  
data: [30,40,45,50,49,60,70,91,125]  
}],

How can I replace a static data value with, for example, the value of:

{{ contact.tenancy\_created\_company }} ? I’m assuming I need to ‘set’ this value in the HTML/Hubl but I’m struggling to get anywhere.

I’d be really grateful for any help!

---

<div class="post-metadata">

**Author:** ![Kevin-C](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/kevin-c/32/34570_2.png) [@Kevin-C](https://community.hubspot.com/u/Kevin-C)\
**Post date:** [January 20, 2020, 1:48pm UTC](https://community.hubspot.com/t/use-crm-data-in-js/18199/2 "2020-01-20T13:48:26Z")

</div>

Hey @tommitchell

You might be able to use the [tojson filter](https://designers.hubspot.com/docs/hubl/hubl-supported-filters#tojson) to output the data needed to a global in the html/hubl. Then with your custom JS, parse and declare it to your object key.

---

<div class="post-metadata">

**Author:** ![alyssamwilie](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/alyssamwilie/32/2072_2.png) [@alyssamwilie](https://community.hubspot.com/u/alyssamwilie)\
**Post date:** [January 22, 2020, 2:23am UTC](https://community.hubspot.com/t/use-crm-data-in-js/18199/3 "2020-01-22T02:23:37Z")

</div>

Yes, you would need to declare the data in the HTML/HUBL. Something like:  
**HTML/HUBL**

```auto
<script>
 window.data = {
 {{ contact.tenancy_created_company|tojson }}
 }
</script>

```

**JS**

```auto
series: [{
 name: 'sales',
 data: window.data
}]

```
