Note created with API does not appear

Hello
I am trying to create a note on a contact from the “custom code” module in workflows.
For some reason, the code seems to be working fine and I also see on the tests that the note has been created, but I can’t find the note on the record.
When I run the same code from external enviroment, not from the custom code module, it works properly and the note is shown.
Someone knows maybe what can cause this issue?
The code:

const hubspot = require('@hubspot/api-client');
const fetch = require("node-fetch"); 

exports.main = async (event, callback) => {

 const dup_email = event.inputFields['dup_email'];
const recordid = event.inputFields['recordid'];

const hubspotApiKey = new hubspot.Client({"accessToken":"MYTOKEN"});
const timestamp = event.inputFields['createdDate']; 

const properties = {
 "hs_timestamp": timestamp,
 "hs_note_body": "Please check for a possible duplicate with 'dup_email'"
};
const SimplePublicObjectInputForCreate = { properties, associations: [{"to":{"id":recordid},"types":[{"associationCategory":"HUBSPOT_DEFINED","associationTypeId":202}]}] };

try {
 const apiResponse = await hubspotApiKey.crm.objects.notes.basicApi.create(SimplePublicObjectInputForCreate);
 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)
 }
};

A video that demonstrates the problem:

https://www.loom.com/share/445711a973104c6ea375ea33b8a4a5c8

Hi, @IRon2 :waving_hand: Thanks for reaching out. One request, can you add your code here as a code block? Minus your access key :blush:

This will be easier for the community to try to reproduce the issue and troubleshoot where possible.

Thank you! — Jaycee

Thanks,
I’ve edited the post

Hi @IRon2

It’s possible that the note is not visible on the contact record because it is not associated with the correct object ID. In your code, you are associating the note with the record ID provided as an input field. However, this ID may not be the correct ID for the contact record you are trying to add the note to. I suggest checking the record ID of the contact you are trying to add the note to and verifying that it matches the record ID provided in the input field. Additionally, make sure that the note is not being associated with another object, such as a deal or a ticket. You can check this by verifying that the `associationTypeId` in the code is set to 1, which is the ID for contacts. Lastly, make sure that the note is not being filtered out of the view due to your current filter settings. You can check this by adjusting your filter settings or by searching for the note using the search bar in the HubSpot UI.

Please mark it as SOLUTION ACCEPTED if you like the solution.

Thank you!

Hi, i have exact the same issue, what was the problem? thanks in advance