Dear Community
I want to use API(hubspotClient.crm.objects.basicApi.create) to create associations in workflow custome code. but object was created,associations was not created use the following code
const properties = {
"dealname_lot": "BB",
"deal_stage_copy": "75418027",
"hubspot_owner_id": "554201143",
"country": "Philippines",
"hs_pipeline": "42134661",
"hs_pipeline_stage": "88330293",
"sales_lot_amount": "1000",
"sales_record_month": "2023-10-11"
};
const SimplePublicObjectInputForCreate = { associations: [{"types":[{"associationCategory":"USER_DEFINED","associationTypeId":17}],"to":{"id":"15390771024"}}], properties };
const objectType = "2-18983127";
await hubspotClient.crm.objects.basicApi.create(objectType, SimplePublicObjectInputForCreate);<div><div><span> <span>When <span>i <span>use <span>associations <span>API<span>-<span>V4<span>, <span>the <span>following <span>error <span>was <span>occurred.<li-code lang="javascript">const BatchInputPublicAssociationMultiPost = { inputs: [{"types":[{"associationCategory":"USER_DEFINED","associationTypeId":17}],"_from":{"id":"9344806988"},"to":{"id":"15390771024"}}] };
const fromObjectType = "2-18983127";
const toObjectType = "0-3";
const apiResponse = await hubspotClient.crm.associations.v4.batchApi.create(fromObjectType, toObjectType, BatchInputPublicAssociationMultiPost);
{"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"TypeError: Cannot read properties of undefined (reading 'basicApi')","reason":{"errorType":"TypeError","errorMessage":"Cannot read properties of undefined (reading 'basicApi')","stack":["TypeError: Cannot read properties of undefined (reading 'basicApi')"," at Object.exports.main (/var/task/file.js:47:43)"," at Runtime.exports.hubspot_handler [as handler] (/var/task/hubspotHandler.js:6:21)"," at Runtime.handleOnceNonStreaming (file:///var/runtime/index.mjs:1147:29)"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: TypeError: Cannot read properties of undefined (reading 'basicApi')"," at process.<anonymous> (file:///var/runtime/index.mjs:1250:17)"," at process.emit (node:events:513:28)"," at emit (node:internal/process/promises:140:20)"," at processPromiseRejections (node:internal/process/promises:274:27)"," at processTicksAndRejections (node:internal/process/task_queues:97:32)"]}<div><div><span>When <span>i <span>use <span>associations <span>API<span>-<span>V3<span>, <span>the <span>associations <span>can <span>be <span>created <span><span>successfully.<li-code lang="javascript">const BatchInputPublicAssociation = { inputs: [{"_from":{"id":"9346258577"},"to":{"id":"15390771024"},"type":"17"}] };
const fromObjectType = "2-18983127";
const toObjectType = "0-3";
const apiResponse = await hubspotClient.crm.associations.batchApi.create(fromObjectType, toObjectType, BatchInputPublicAssociation);
<p>how can i use <span>API<span>(<span>hubspotClient<span>.<span>crm<span>.<span>objects<span>.<span>basicApi<span>.<span>create<span>) <span>to <span>create <span>associations <span>in <span>workflow <span>custome <span>code?</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>


