<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: problems with custom code not updating data output in Data Hub</title>
    <link>https://community.hubspot.com/t5/Data-Hub/problems-with-custom-code-not-updating-data-output/m-p/1139175#M3008</link>
    <description>&lt;P class=""&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/923812"&gt;@CWhite36&lt;/a&gt;&amp;nbsp;Nice work&lt;BR /&gt;&lt;BR /&gt;At this point the missing link is how those outputs get written back to the contact record. In HubSpot, a custom‑code action &lt;STRONG&gt;doesn’t automatically push its output into the CRM&lt;/STRONG&gt;; the values just become tokens you can use in later workflow steps.&lt;/P&gt;&lt;P class=""&gt;Quick fix:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P class=""&gt;Right after the custom‑code action, add a &lt;STRONG&gt;“Set property value”&lt;/STRONG&gt; (or “Copy property value”) step.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class=""&gt;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).&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class=""&gt;Save and re‑enroll a contact. You should see the fields populate a few seconds after the workflow fires.&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P class=""&gt;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.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P class=""&gt;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.&lt;BR /&gt;&lt;BR /&gt;Ping back if it’s still blank—we’ll dig deeper.&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="RubenB_0-1745338477063.png" style="width: 200px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/144043iF5709EFEC0FDBB40/image-size/small?v=v2&amp;amp;px=200" role="button" title="RubenB_0-1745338477063.png" alt="RubenB_0-1745338477063.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;A href="https://www.linkedin.com/in/ruben-burdin/" target="_blank" rel="noopener nofollow noreferrer"&gt;Ruben Burdin&lt;/A&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Real-Time Data Sync Between any CRM or Database | Founder @&lt;A href="https://l.stacksync.com/hubspot" target="_blank" rel="nofollow noopener noreferrer"&gt;Stacksync&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(YC W24)&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 22 Apr 2025 16:16:17 GMT</pubDate>
    <dc:creator>RubenBurdin</dc:creator>
    <dc:date>2025-04-22T16:16:17Z</dc:date>
    <item>
      <title>problems with custom code not updating data output</title>
      <link>https://community.hubspot.com/t5/Data-Hub/problems-with-custom-code-not-updating-data-output/m-p/1138699#M3005</link>
      <description>&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;const dns = require('dns').promises;&lt;/P&gt;&lt;P&gt;exports.main = async (event, callback) =&amp;gt; {&lt;BR /&gt;const email = event.inputFields['email'];&lt;BR /&gt;console.log('Email received:', email);&lt;/P&gt;&lt;P&gt;let dmarcResult = 'Invalid or missing email';&lt;BR /&gt;let checkedDate = new Date().toISOString().split('T')[0]; // Format: YYYY-MM-DD&lt;/P&gt;&lt;P&gt;if (email &amp;amp;&amp;amp; email.includes('@')) {&lt;BR /&gt;const domain = email.split('@')[1];&lt;BR /&gt;console.log('Domain extracted:', domain);&lt;/P&gt;&lt;P&gt;try {&lt;BR /&gt;const records = await dns.resolveTxt(`_dmarc.${domain}`);&lt;BR /&gt;if (records.length &amp;gt; 0) {&lt;BR /&gt;dmarcResult = records.map(r =&amp;gt; r.join('')).join('\n');&lt;BR /&gt;} else {&lt;BR /&gt;dmarcResult = `No DMARC record found for ${domain}`;&lt;BR /&gt;}&lt;BR /&gt;} catch (error) {&lt;BR /&gt;dmarcResult = `DNS lookup failed for ${domain}`;&lt;BR /&gt;console.log('DNS error:', error.message);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;console.log('DMARC result:', dmarcResult);&lt;BR /&gt;console.log('Checked date:', checkedDate);&lt;/P&gt;&lt;P&gt;callback({&lt;BR /&gt;outputFields: {&lt;BR /&gt;dmarc_status_2: dmarcResult,&lt;BR /&gt;dmarc_last_checked: checkedDate&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it doesnt seem to be mapping to the 2 data outputs i have created - dmarc_status_2: dmarcResult (as a string) and&amp;nbsp; dmarc_last_checked (as a date)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Apr 2025 20:47:06 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/problems-with-custom-code-not-updating-data-output/m-p/1138699#M3005</guid>
      <dc:creator>CWhite36</dc:creator>
      <dc:date>2025-04-21T20:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: problems with custom code not updating data output</title>
      <link>https://community.hubspot.com/t5/Data-Hub/problems-with-custom-code-not-updating-data-output/m-p/1138766#M3006</link>
      <description>&lt;P class=""&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/923812"&gt;@CWhite36&lt;/a&gt;&amp;nbsp;this one’s tricky because everything in your code actually &lt;EM&gt;looks fine at a glance&lt;/EM&gt;, but the issue likely isn’t in your logic — it’s probably in the way the &lt;STRONG&gt;custom code action is configured inside your workflow&lt;/STRONG&gt;.&lt;BR /&gt;&lt;BR /&gt;Here’s what I’d check:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P class=""&gt;&lt;STRONG&gt;Make sure the output field keys exactly match the internal property names&lt;/STRONG&gt; — 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.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class=""&gt;&lt;STRONG&gt;Confirm your output fields are mapped in the workflow step&lt;/STRONG&gt; — in the custom code action, you need to &lt;STRONG&gt;manually define the output fields&lt;/STRONG&gt; 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 }).&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class=""&gt;&lt;STRONG&gt;Watch for return timing or async behavior issues&lt;/STRONG&gt; — unlikely in your code since you’re using await properly and calling callback() only once, but if there’s &lt;EM&gt;any&lt;/EM&gt; 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.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class=""&gt;&lt;STRONG&gt;Check field types&lt;/STRONG&gt; — if dmarc_last_checked is a &lt;STRONG&gt;date property&lt;/STRONG&gt;, HubSpot expects it in &lt;STRONG&gt;UNIX timestamp (milliseconds)&lt;/STRONG&gt;, not ISO string. So you’d want to do:&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const checkedDate = new Date().getTime(); // returns UNIX ms timestamp&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="RubenB_0-1745287513359.png" style="width: 200px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/143936i636BF704D5E76115/image-size/small?v=v2&amp;amp;px=200" role="button" title="RubenB_0-1745287513359.png" alt="RubenB_0-1745287513359.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;A href="https://www.linkedin.com/in/ruben-burdin/" target="_blank" rel="noopener nofollow noreferrer"&gt;Ruben Burdin&lt;/A&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Real-Time Data Sync Between any CRM or Database | Founder @&lt;A href="https://www.stacksync.com/" target="_blank" rel="noopener nofollow noreferrer"&gt;Stacksync&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(YC W24)&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Apr 2025 02:32:10 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/problems-with-custom-code-not-updating-data-output/m-p/1138766#M3006</guid>
      <dc:creator>RubenBurdin</dc:creator>
      <dc:date>2025-04-22T02:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: problems with custom code not updating data output</title>
      <link>https://community.hubspot.com/t5/Data-Hub/problems-with-custom-code-not-updating-data-output/m-p/1138888#M3007</link>
      <description>&lt;P&gt;Thank you RubenB&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have updated the unix timestamp code.&amp;nbsp;&amp;nbsp;This is the workflow, not long at all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CWhite36_0-1745314393897.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/143968i7DF94EE18E7345AB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CWhite36_0-1745314393897.png" alt="CWhite36_0-1745314393897.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CWhite36_1-1745314466309.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/143969i44A76B433FA9DCCA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CWhite36_1-1745314466309.png" alt="CWhite36_1-1745314466309.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CWhite36_2-1745314482032.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/143970i22A3836A1880DD31/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CWhite36_2-1745314482032.png" alt="CWhite36_2-1745314482032.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have run a test on an existing contact which appears succesful&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CWhite36_3-1745314567489.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/143972i845871949FE01CD7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CWhite36_3-1745314567489.png" alt="CWhite36_3-1745314567489.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I then checked the tested contact and data hasnt been populated in the fields in the crm.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Apr 2025 09:36:48 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/problems-with-custom-code-not-updating-data-output/m-p/1138888#M3007</guid>
      <dc:creator>CWhite36</dc:creator>
      <dc:date>2025-04-22T09:36:48Z</dc:date>
    </item>
    <item>
      <title>Re: problems with custom code not updating data output</title>
      <link>https://community.hubspot.com/t5/Data-Hub/problems-with-custom-code-not-updating-data-output/m-p/1139175#M3008</link>
      <description>&lt;P class=""&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/923812"&gt;@CWhite36&lt;/a&gt;&amp;nbsp;Nice work&lt;BR /&gt;&lt;BR /&gt;At this point the missing link is how those outputs get written back to the contact record. In HubSpot, a custom‑code action &lt;STRONG&gt;doesn’t automatically push its output into the CRM&lt;/STRONG&gt;; the values just become tokens you can use in later workflow steps.&lt;/P&gt;&lt;P class=""&gt;Quick fix:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P class=""&gt;Right after the custom‑code action, add a &lt;STRONG&gt;“Set property value”&lt;/STRONG&gt; (or “Copy property value”) step.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class=""&gt;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).&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class=""&gt;Save and re‑enroll a contact. You should see the fields populate a few seconds after the workflow fires.&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P class=""&gt;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.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P class=""&gt;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.&lt;BR /&gt;&lt;BR /&gt;Ping back if it’s still blank—we’ll dig deeper.&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="RubenB_0-1745338477063.png" style="width: 200px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/144043iF5709EFEC0FDBB40/image-size/small?v=v2&amp;amp;px=200" role="button" title="RubenB_0-1745338477063.png" alt="RubenB_0-1745338477063.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;A href="https://www.linkedin.com/in/ruben-burdin/" target="_blank" rel="noopener nofollow noreferrer"&gt;Ruben Burdin&lt;/A&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Real-Time Data Sync Between any CRM or Database | Founder @&lt;A href="https://l.stacksync.com/hubspot" target="_blank" rel="nofollow noopener noreferrer"&gt;Stacksync&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(YC W24)&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Apr 2025 16:16:17 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/problems-with-custom-code-not-updating-data-output/m-p/1139175#M3008</guid>
      <dc:creator>RubenBurdin</dc:creator>
      <dc:date>2025-04-22T16:16:17Z</dc:date>
    </item>
    <item>
      <title>Re: problems with custom code not updating data output</title>
      <link>https://community.hubspot.com/t5/Data-Hub/problems-with-custom-code-not-updating-data-output/m-p/1141645#M3018</link>
      <description>&lt;P&gt;Ruben,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks for the solution, this has now been fixed and all working smoothly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you again for the help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Mon, 28 Apr 2025 11:44:26 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/problems-with-custom-code-not-updating-data-output/m-p/1141645#M3018</guid>
      <dc:creator>CWhite36</dc:creator>
      <dc:date>2025-04-28T11:44:26Z</dc:date>
    </item>
  </channel>
</rss>

