# Find any "John" in Hubspot and put it in a Javascript array

**URL:** <https://community.hubspot.com/t/find-any-john-in-hubspot-and-put-it-in-a-javascript-array/19708>\
**Category:** CMS Development\
**Tags:** javascript\
**Created:** [March 29, 2020, 7:48am UTC](https://community.hubspot.com/t/find-any-john-in-hubspot-and-put-it-in-a-javascript-array/19708 "2020-03-29T07:48:10Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![basvanKesteren](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/basvankesteren/32/76793_2.png) [@basvanKesteren](https://community.hubspot.com/u/basvanKesteren)\
**Post date:** [March 29, 2020, 7:48am UTC](https://community.hubspot.com/t/find-any-john-in-hubspot-and-put-it-in-a-javascript-array/19708/1 "2020-03-29T07:48:10Z")

</div>

It is possible to find records with a certain name (fe john) and put his data (email, company etc) in a javascript array? Thanks for helping.

---

<div class="post-metadata">

**Author:** ![MikeCormack](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mikecormack/32/22307_2.png) [@MikeCormack](https://community.hubspot.com/u/MikeCormack)\
**Post date:** [March 30, 2020, 12:15pm UTC](https://community.hubspot.com/t/find-any-john-in-hubspot-and-put-it-in-a-javascript-array/19708/2 "2020-03-30T12:15:38Z")

</div>

You can’t legally put customer details like this in your front end, would be a data breach.

---

<div class="post-metadata">

**Author:** ![basvanKesteren](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/basvankesteren/32/76793_2.png) [@basvanKesteren](https://community.hubspot.com/u/basvanKesteren)\
**Post date:** [March 30, 2020, 6:11pm UTC](https://community.hubspot.com/t/find-any-john-in-hubspot-and-put-it-in-a-javascript-array/19708/3 "2020-03-30T18:11:17Z")

</div>

Hi Mike, thanks for the response. I totally agree. I want to calculate the average of their scores (via Forms). It is not about their personal data.

---

<div class="post-metadata">

**Author:** ![MikeCormack](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mikecormack/32/22307_2.png) [@MikeCormack](https://community.hubspot.com/u/MikeCormack)\
**Post date:** [March 30, 2020, 10:43pm UTC](https://community.hubspot.com/t/find-any-john-in-hubspot-and-put-it-in-a-javascript-array/19708/4 "2020-03-30T22:43:01Z")

</div>

Okay in that case I am not sure I understand the question, yes you can convert any dataset to a JavaScript array. Which scores are you thinking? I’ve used excel in the past to reformat a dataset into a way I wanted it by adding my code in columns and exporting the data as cvs and removing commas. Janky workaround, I mean you could programtically do the same easily enough in anything. Why a JavaScript array? Internal reporting?

---

<div class="post-metadata">

**Author:** ![basvanKesteren](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/basvankesteren/32/76793_2.png) [@basvanKesteren](https://community.hubspot.com/u/basvanKesteren)\
**Post date:** [March 31, 2020, 9:04am UTC](https://community.hubspot.com/t/find-any-john-in-hubspot-and-put-it-in-a-javascript-array/19708/5 "2020-03-31T09:04:11Z")

</div>

In a form I am asking 3 questions on how happy people are in their team. They can score from 1 to 5 on

1. Your Overall score of the team

2. Do you have a clear role in the team?

3. Are you happy in the team?

if 20 people fill out the form I want to calculate the average score per question.  
And present this immediately after filling in the form, on a landing page.  
Each of the 20 team members receive a teamcode, they need to fill that in the first formquestion.

thanks for helping.

---

<div class="post-metadata">

**Author:** ![MikeCormack](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mikecormack/32/22307_2.png) [@MikeCormack](https://community.hubspot.com/u/MikeCormack)\
**Post date:** [March 31, 2020, 10:33am UTC](https://community.hubspot.com/t/find-any-john-in-hubspot-and-put-it-in-a-javascript-array/19708/6 "2020-03-31T10:33:47Z")

</div>

Do you have calculation fields?

I dont think they will update fast enough to use as they are dependants.

Would emailing them be okay? that way you can build in the time for the calculation field to update into the workflow so the information is there.

If not you can do it again via email, send them a link and use hidden personalisation fields with the scores, and then reconstruct with javascript on the front end.

You could also test using the personalisation field calculated in the post form page, but I am almost 100% that will not work.

If you have to get them to a new page, and the calculation field does not work, you could reconstruct the URL with a query string in javascript putting the scores into the parameters that you could then access with hubl and calculate the score there,you’ll need to use a raw html form for that so you can edit the submit url

---

<div class="post-metadata">

**Author:** ![MikeCormack](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mikecormack/32/22307_2.png) [@MikeCormack](https://community.hubspot.com/u/MikeCormack)\
**Post date:** [March 31, 2020, 10:36am UTC](https://community.hubspot.com/t/find-any-john-in-hubspot-and-put-it-in-a-javascript-array/19708/7 "2020-03-31T10:36:04Z")

</div>

I missed a bit, to aggregate the scores you’ll need to push the data up to the company record with a workflow and do that bit there

---

<div class="post-metadata">

**Author:** ![basvanKesteren](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/basvankesteren/32/76793_2.png) [@basvanKesteren](https://community.hubspot.com/u/basvanKesteren)\
**Post date:** [March 31, 2020, 11:29am UTC](https://community.hubspot.com/t/find-any-john-in-hubspot-and-put-it-in-a-javascript-array/19708/8 "2020-03-31T11:29:40Z")

</div>

Hi Mike,

Thanks for the response. I need those average scores in Javascript to do more calculations.

I already have the individual scores in Javascript and I can present them to the individuals (based on their email) on the landingpage.

---

<div class="post-metadata">

**Author:** ![MikeCormack](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mikecormack/32/22307_2.png) [@MikeCormack](https://community.hubspot.com/u/MikeCormack)\
**Post date:** [March 31, 2020, 3:34pm UTC](https://community.hubspot.com/t/find-any-john-in-hubspot-and-put-it-in-a-javascript-array/19708/9 "2020-03-31T15:34:13Z")

</div>

Right so pull them from the company record with account.fieldname ?

---

<div class="post-metadata">

**Author:** ![basvanKesteren](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/basvankesteren/32/76793_2.png) [@basvanKesteren](https://community.hubspot.com/u/basvanKesteren)\
**Post date:** [April 1, 2020, 7:27am UTC](https://community.hubspot.com/t/find-any-john-in-hubspot-and-put-it-in-a-javascript-array/19708/10 "2020-04-01T07:27:01Z")

</div>

Hi Mike, that’s a good idea. Can you show me how to do that in Javascript?
