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?