Hi @BVowles , yep, this one is super common when you’re new to Data Hub and custom code actions. The “Not defined in code” message almost always means HubSpot didn’t see the output in the exact structure it expects, or the output field name in the action UI doesn’t match what you returned. In HubSpot custom code actions, outputs need to be returned under the outputFields wrapper, like this:
Without that wrapper, HubSpot logs the value in execution, but the workflow UI treats it as “not produced,” so your downstream steps show “Not defined in code.” HubSpot’s doc calls out this output contract pretty explicitly (Workflows | Custom Code Actions - HubSpot docs )
One more thing to double-check: in the action’s “Outputs” section, did you create an output with the internal name exactly parentDealId (same casing), and not parent_deal_id or similar? A tiny mismatch there will produce the same symptom.
Your fetch call to the associations endpoint is fine for Node 20, and your secret usage looks correct as long as the secret key name in the UI is exactly Account_API_Key. If you want to stay fully “HubSpot SDK-native” later, you can also fetch associations via the CRM Associations API (Accounts Dashboard | HubSpot )