# Batch create custom object records via a custom coded action with associations

**URL:** <https://community.hubspot.com/t/batch-create-custom-object-records-via-a-custom-coded-action-with-associations/93248>\
**Category:** APIs & Integrations\
**Tags:** professional\
**Created:** [November 3, 2023, 4:34pm UTC](https://community.hubspot.com/t/batch-create-custom-object-records-via-a-custom-coded-action-with-associations/93248 "2023-11-03T16:34:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MWWesterterp](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mwwesterterp/32/19243_2.png) [@MWWesterterp](https://community.hubspot.com/u/MWWesterterp)\
**Post date:** [November 3, 2023, 4:34pm UTC](https://community.hubspot.com/t/batch-create-custom-object-records-via-a-custom-coded-action-with-associations/93248/1 "2023-11-03T16:34:57Z")

</div>

Hi All,

Hope you can help me with the following:

I want to make 100 custom object records via a custom coded workflow with associations.

If i search the api-documentation, this code should work:

const BatchInputSimplePublicObjectInputForCreate = { inputs: [{“associations”:[{“types”:[{“associationCategory”:“USER\_DEFINED”,“associationTypeId”:215}],“to”:{“id”:“301”}},{“types”:[{“associationCategory”:“USER\_DEFINED”,“associationTypeId”:203}],“to”:{“id”:“1102046420”}}],“properties”:{“voucher\_type”:“course”,“voucher\_course\_id”:“2226210”,“voucher\_id”:1}}] };  
const objectType = “vouchers”;

try {  
const apiResponse = await hubspotClient.crm.objects.batchApi.create(objectType, BatchInputSimplePublicObjectInputForCreate);  
console.log(JSON.stringify(apiResponse, null, 2));  
} catch (e) {  
e.message === ‘HTTP request failed’  
? console.error(JSON.stringify(e.response, null, 2))  
: console.error(e)  
}

However when I put the exact same code in a custom coded workflow, it does creates the custom object, but it doesn’t create the associations… Do you have any idea what this could be?
