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:
But it seems I cannot use those values, I only get this error:
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:
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)
});
}


