<?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: Automated Email - Populated using HubDB &amp;amp; HubL in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Automated-Email-Populated-using-HubDB-amp-HubL/m-p/640045#M28886</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/264909"&gt;@ChrisChiha&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wrote this real quick, so could be some errors, but it could look something like this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;const axios = require('axios');

exports.main = async (event, callback) =&amp;gt; {
  const email = event.inputFields['email'];
  let rowFound = false

  const result = await axios({
    method: 'get',
    headers: { 'content-type': 'application/json' },
    url: `https://api.hubapi.com/cms/v3/hubdb/tables/${tableId}/rows?portalId=${portalId}&amp;amp;limit=1&amp;amp;email__eq=${email}`,
  }).then((response) =&amp;gt; {
    console.log(response.data)
    if (response.data &amp;amp;&amp;amp; response.data.results) {
      rowFound = true
    }
  }).catch((error) =&amp;gt; {
    console.log(error)
  })

  callback({
    outputFields: {
      rowFound: rowFound
    }
  });
}
&lt;/LI-CODE&gt;
&lt;P&gt;You can then use the 'rowFound' property in the output to handle the following steps of your workflow (you might have to use the Copy to Property action first).&lt;/P&gt;</description>
    <pubDate>Fri, 27 May 2022 07:05:13 GMT</pubDate>
    <dc:creator>Teun</dc:creator>
    <dc:date>2022-05-27T07:05:13Z</dc:date>
    <item>
      <title>Automated Email - Populated using HubDB &amp; HubL</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Automated-Email-Populated-using-HubDB-amp-HubL/m-p/638601#M28861</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;SPAN&gt;I am sending a daily digest to my partners that is being populated from my hubdb table, and is being triggered by a workflow. (The HubDB table is being filled daily from my Backend)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;U&gt;&lt;STRONG&gt;How it is currently working:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If the email address enrolled in the wokflow, is found in the HubDB table, then the row is fetched to the communication. The daily digest is working great right now, but now, even if the email address is not found in the hubdb table, the email is enrolled in the wokrflow.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I would like to know if it is possible to only send the email to enrolled people in the workflow, if their email address is present in the hubdb table.&lt;/SPAN&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;&lt;STRONG&gt;I have a list of partners that are being enrolled in my workflow. Ideally, what i want to achieve; If the enrolled partner email is not found in the HubDB table column "email", i don't want the email communication to be triggered to him. is this possible?&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Another question i had in mind:&lt;/STRONG&gt;&lt;/U&gt;&lt;BR /&gt;&lt;SPAN&gt;Is it possible to trigger a workflow when a new row is added to the hubdb table ?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2022 04:03:40 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Automated-Email-Populated-using-HubDB-amp-HubL/m-p/638601#M28861</guid>
      <dc:creator>ChrisChiha</dc:creator>
      <dc:date>2022-05-26T04:03:40Z</dc:date>
    </item>
    <item>
      <title>Re: Automated Email - Populated using HubDB &amp; HubL</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Automated-Email-Populated-using-HubDB-amp-HubL/m-p/639121#M28871</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/264909"&gt;@ChrisChiha&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This sounds like an interesting project!&lt;/P&gt;
&lt;P&gt;Going to&amp;nbsp; throw a few folks into this to see what comes of it&lt;/P&gt;
&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/13203"&gt;@tmcmillan99&lt;/a&gt; , &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/17186"&gt;@Anton&lt;/a&gt; , &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/2062"&gt;@Josh&lt;/a&gt; , &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/241684"&gt;@ChrisoKlepke&lt;/a&gt;&amp;nbsp; what do you all think?&lt;/P&gt;
&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/13203"&gt;@tmcmillan99&lt;/a&gt;&amp;nbsp; and &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/241684"&gt;@ChrisoKlepke&lt;/a&gt;&amp;nbsp; are already having an interesting discussion on&lt;A href="https://community.hubspot.com/t5/CMS-Development/HubDB-vs-Custom-Object-Best-scenario-option/td-p/637789" target="_blank" rel="noopener"&gt; Custom Objects vs HubDB &lt;/A&gt;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2022 20:12:47 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Automated-Email-Populated-using-HubDB-amp-HubL/m-p/639121#M28871</guid>
      <dc:creator>dennisedson</dc:creator>
      <dc:date>2022-05-25T20:12:47Z</dc:date>
    </item>
    <item>
      <title>Re: Automated Email - Populated using HubDB &amp; HubL</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Automated-Email-Populated-using-HubDB-amp-HubL/m-p/640032#M28884</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/264909"&gt;@ChrisChiha&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have Operations Hub? If so, you can write a coded action that checks if a row exists and you can use the output to create a if / then branch to decide if you want to send the e-mail.&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 06:47:51 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Automated-Email-Populated-using-HubDB-amp-HubL/m-p/640032#M28884</guid>
      <dc:creator>Teun</dc:creator>
      <dc:date>2022-05-27T06:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: Automated Email - Populated using HubDB &amp; HubL</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Automated-Email-Populated-using-HubDB-amp-HubL/m-p/640036#M28885</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/101258"&gt;@Teun&lt;/a&gt;,&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;Yes that's what i was trying to achieve, adding a custom code at the beginning of the workflow to check if the email is found in any of the hubdb table rows.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;I have operations hub and marketing enterprise.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;Do you have any sample or documentation that might help/guide me in writing this custom code?&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/264909"&gt;@ChrisChiha&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 06:54:21 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Automated-Email-Populated-using-HubDB-amp-HubL/m-p/640036#M28885</guid>
      <dc:creator>ChrisChiha</dc:creator>
      <dc:date>2022-05-27T06:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: Automated Email - Populated using HubDB &amp; HubL</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Automated-Email-Populated-using-HubDB-amp-HubL/m-p/640045#M28886</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/264909"&gt;@ChrisChiha&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wrote this real quick, so could be some errors, but it could look something like this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;const axios = require('axios');

exports.main = async (event, callback) =&amp;gt; {
  const email = event.inputFields['email'];
  let rowFound = false

  const result = await axios({
    method: 'get',
    headers: { 'content-type': 'application/json' },
    url: `https://api.hubapi.com/cms/v3/hubdb/tables/${tableId}/rows?portalId=${portalId}&amp;amp;limit=1&amp;amp;email__eq=${email}`,
  }).then((response) =&amp;gt; {
    console.log(response.data)
    if (response.data &amp;amp;&amp;amp; response.data.results) {
      rowFound = true
    }
  }).catch((error) =&amp;gt; {
    console.log(error)
  })

  callback({
    outputFields: {
      rowFound: rowFound
    }
  });
}
&lt;/LI-CODE&gt;
&lt;P&gt;You can then use the 'rowFound' property in the output to handle the following steps of your workflow (you might have to use the Copy to Property action first).&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 07:05:13 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Automated-Email-Populated-using-HubDB-amp-HubL/m-p/640045#M28886</guid>
      <dc:creator>Teun</dc:creator>
      <dc:date>2022-05-27T07:05:13Z</dc:date>
    </item>
    <item>
      <title>Re: Automated Email - Populated using HubDB &amp; HubL</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Automated-Email-Populated-using-HubDB-amp-HubL/m-p/640989#M28903</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/101258"&gt;@Teun&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;I was able to get this code working, but it is always returning True even when there is no match. The outcome is right (Giving me 0 matches), but the code is still considering as True. I guess the problem is with the If statement, as it is considering any log as "True", even if the log is showing no matches.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2022-05-30 at 7.22.26 AM.png" style="width: 386px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/67456iECCA3F8A9CA36D8A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2022-05-30 at 7.22.26 AM.png" alt="Screen Shot 2022-05-30 at 7.22.26 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;UPDATE:&lt;/STRONG&gt;&lt;BR /&gt;It worked, just had to replace the if statement by the below. Thank you !!&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;if (response.data.total &amp;gt; 0) {&lt;BR /&gt;rowFound = true&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Mon, 30 May 2022 05:23:13 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Automated-Email-Populated-using-HubDB-amp-HubL/m-p/640989#M28903</guid>
      <dc:creator>ChrisChiha</dc:creator>
      <dc:date>2022-05-30T05:23:13Z</dc:date>
    </item>
    <item>
      <title>Re: Automated Email - Populated using HubDB &amp; HubL</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Automated-Email-Populated-using-HubDB-amp-HubL/m-p/641016#M28904</link>
      <description>&lt;P&gt;Awesome! Happy you got it working!&lt;/P&gt;</description>
      <pubDate>Mon, 30 May 2022 06:17:58 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Automated-Email-Populated-using-HubDB-amp-HubL/m-p/641016#M28904</guid>
      <dc:creator>Teun</dc:creator>
      <dc:date>2022-05-30T06:17:58Z</dc:date>
    </item>
  </channel>
</rss>

