# Copy property value action with cutom code output

**URL:** <https://community.hubspot.com/t/copy-property-value-action-with-cutom-code-output/86246>\
**Category:** Data Hub\
**Created:** [July 27, 2023, 10:03am UTC](https://community.hubspot.com/t/copy-property-value-action-with-cutom-code-output/86246 "2023-07-27T10:03:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ACandian](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/acandian/32/7289_2.png) [@ACandian](https://community.hubspot.com/u/ACandian)\
**Post date:** [July 27, 2023, 10:03am UTC](https://community.hubspot.com/t/copy-property-value-action-with-cutom-code-output/86246/1 "2023-07-27T10:03:51Z")

</div>

Hello everyone!

I’m having trouble with the workflow action **Copy property value** used to update the deal amount.

The value that need to be used comes from a custom coded action.

The value is outputed by

callback

as usual like this:`callback({ deal_amount: parseInt(amount)});`

so the custom coded action output is like:

`{"deal_amount":50}`

So like I said I’m using this output to update the deal enrolled in the workflow with the Copy property value like this:

 ![ACandian_1-1690452020464.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/e/a/ea9c9eea1d676127ca40ec89eca69e83fa58ba56.png)

 ![ACandian_2-1690452053686.png](https://d2qpr2jzcazej7.cloudfront.net/original/2X/e/ec137c79545f64e92d66a0696fb888679042d5f2.png)

But it seems I cannot use those values, I only get this error:

 ![ACandian_0-1690451984280.png](https://d2qpr2jzcazej7.cloudfront.net/original/2X/5/5b78e1bf678c2976daa5a76d3b6497ca84e3c81e.png)

I verified the output type, I used an integer, a float and a string and either way the Copy property value won’t update the deal Amount.

Can anyone help me with this?

Thanks!

If you are curious about the whole code:

```lia-code-sample
const hubspot = require('@hubspot/api-client');
const axios = require('axios');
const hubspotClient = new hubspot.Client({accessToken: process.env.CustomCodeToken});
let amount = 0;

exports.main = async (event, callback) => {
 const headers = { "Authorization": "Bearer " + process.env.CustomCodeToken};
 const { data: { results: ass_contact } } = await axios.get(`https://api.hubapi.com/crm/v4/objects/deal/${event.object.objectId}/associations/contact`,{ headers: headers} );
 console.log(JSON.stringify(ass_contact, null, 2));
 // console.log(ass_contact[0].toObjectId);
 let query = { "filterGroups":[{ "filters":[ { "propertyName": "associations.contact", "operator": "EQ", "value": ass_contact[0].toObjectId } ] } ] };
 const deals = await hubspotClient.crm.deals.searchApi.doSearch(query);
 //console.log(JSON.stringify(deals, null, 2));
 if(deals.total > 0){
 deals.results.forEach(d => {
 if (d.properties.pipeline == "default") {
 amount = d.properties.amount;
 console.log(d.properties.amount);
 }
 });
 }

 callback({
 deal_amount: parseFloat(amount)
 });
}

```

---

<div class="post-metadata">

**Author:** ![ACandian](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/acandian/32/7289_2.png) [@ACandian](https://community.hubspot.com/u/ACandian)\
**Post date:** [July 28, 2023, 6:48am UTC](https://community.hubspot.com/t/copy-property-value-action-with-cutom-code-output/86246/2 "2023-07-28T06:48:56Z")

</div>

Anyone has had the same issue? o(\>\<；)oo

---

<div class="post-metadata">

**Author:** ![kvlschaefer](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/kvlschaefer/32/71076_2.png) [@kvlschaefer](https://community.hubspot.com/u/kvlschaefer)\
**Post date:** [July 28, 2023, 8:41pm UTC](https://community.hubspot.com/t/copy-property-value-action-with-cutom-code-output/86246/3 "2023-07-28T20:41:19Z")

</div>

Hi @ACandian,

Thanks for reaching out to the Community!

I wanted to invite our subject matter experts to see if they have insight.

Hi @HFisher7, @louischausse, @DanielJeal - Have you encountered this error before? Do you have any advice for @ACandian?

Thank you!

Best,

Kristen

---

<div class="post-metadata">

**Author:** ![DanielJeal](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/danieljeal/32/93810_2.png) [@DanielJeal](https://community.hubspot.com/u/DanielJeal)\
**Post date:** [July 31, 2023, 10:03am UTC](https://community.hubspot.com/t/copy-property-value-action-with-cutom-code-output/86246/4 "2023-07-31T10:03:46Z")

</div>

have you tried not parsing the output?

---

<div class="post-metadata">

**Author:** ![ACandian](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/acandian/32/7289_2.png) [@ACandian](https://community.hubspot.com/u/ACandian)\
**Post date:** [July 31, 2023, 12:16pm UTC](https://community.hubspot.com/t/copy-property-value-action-with-cutom-code-output/86246/5 "2023-07-31T12:16:44Z")

</div>

Hi, yes it was my first attempt. I started to forcibly parsing it when I noticed the error

---

<div class="post-metadata">

**Author:** ![louischausse](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/louischausse/32/18067_2.png) [@louischausse](https://community.hubspot.com/u/louischausse)\
**Post date:** [July 31, 2023, 12:51pm UTC](https://community.hubspot.com/t/copy-property-value-action-with-cutom-code-output/86246/6 "2023-07-31T12:51:56Z")

</div>

Hi @ACandian,  
You ommited to nest your output field in the outputFields object like this:

```lia-code-sample
 callback({
 outputFields: {
 deal_amount: amount
 }
 });

```

Don’t forget to mark my reply as a solution if you are satisfied. If not, do not hesitate to ask me anything!

---

<div class="post-metadata">

**Author:** ![ACandian](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/acandian/32/7289_2.png) [@ACandian](https://community.hubspot.com/u/ACandian)\
**Post date:** [July 31, 2023, 1:16pm UTC](https://community.hubspot.com/t/copy-property-value-action-with-cutom-code-output/86246/7 "2023-07-31T13:16:55Z")

</div>

I really need some holiday.

Thanks 😃
