problems with custom code not updating data output
SOLVE
im using some code to check all contact email addresses within hubspot for their dmarc status to inform those contacts to improve their cyber security.
At this point the missing link is how those outputs get written back to the contact record. In HubSpot, a custom‑code action doesn’t automatically push its output into the CRM; the values just become tokens you can use in later workflow steps.
Quick fix:
Right after the custom‑code action, add a “Set property value” (or “Copy property value”) step.
Choose the contact property you want to update—dmarc_status_2—and in the right‑side token list pick the output token with the same name. Do the same for dmarc_last_checked (use the datetime token from the code step).
Save and re‑enroll a contact. You should see the fields populate a few seconds after the workflow fires.
If you’d rather handle it all inside the code, you can use the HubSpot Client to do an update on the contact right before callback(), but the extra “Set property” step keeps the code simpler and is easier to maintain.
Double‑check the internal names (looks like you’ve got them right), then re‑run the workflow on a test contact and the values should show up in the CRM.
problems with custom code not updating data output
SOLVE
@CWhite36 this one’s tricky because everything in your code actually looks fine at a glance, but the issue likely isn’t in your logic — it’s probably in the way the custom code action is configured inside your workflow.
Here’s what I’d check:
Make sure the output field keys exactly match the internal property names — in HubSpot, the property names are not always the same as the label you see in the UI. Double-check that your property internal names are truly dmarc_status_2 and dmarc_last_checked. One small mismatch and HubSpot will just silently ignore the output.
Confirm your output fields are mapped in the workflow step — in the custom code action, you need to manually define the output fields in the right-side panel of the workflow editor. If those aren’t declared and saved there, HubSpot won’t accept the values you're sending back with callback({ outputFields }).
Watch for return timing or async behavior issues — unlikely in your code since you’re using await properly and calling callback() only once, but if there’s any unhandled exception before callback() runs, HubSpot will treat the step as incomplete and not map the fields. You could throw a try/catch around the entire function just to be safe.
Check field types — if dmarc_last_checked is a date property, HubSpot expects it in UNIX timestamp (milliseconds), not ISO string. So you’d want to do:
const checkedDate = new Date().getTime(); // returns UNIX ms timestamp
Let me know if it’s still not working after that — I can help debug the workflow side too if you send a screenshot of the setup.
At this point the missing link is how those outputs get written back to the contact record. In HubSpot, a custom‑code action doesn’t automatically push its output into the CRM; the values just become tokens you can use in later workflow steps.
Quick fix:
Right after the custom‑code action, add a “Set property value” (or “Copy property value”) step.
Choose the contact property you want to update—dmarc_status_2—and in the right‑side token list pick the output token with the same name. Do the same for dmarc_last_checked (use the datetime token from the code step).
Save and re‑enroll a contact. You should see the fields populate a few seconds after the workflow fires.
If you’d rather handle it all inside the code, you can use the HubSpot Client to do an update on the contact right before callback(), but the extra “Set property” step keeps the code simpler and is easier to maintain.
Double‑check the internal names (looks like you’ve got them right), then re‑run the workflow on a test contact and the values should show up in the CRM.