<?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 Checking for - or ' in a name field in Data Hub</title>
    <link>https://community.hubspot.com/t5/Data-Hub/Checking-for-or-in-a-name-field/m-p/676307#M969</link>
    <description>&lt;P&gt;Has any one out there used a custom coded workflow to check for an - or ' in their first name, and to capitalise the first letter proceeding the - or '.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We've used the native data format action in a workflow to change all first names and last names to title case. But that's caused issues for the names that contain an - or '.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We can't find anything online to help troubleshoot this. Would be amazing if this use case was added to the&amp;nbsp;&lt;SPAN&gt;Programmable Automation Use Cases ppage.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 05 Aug 2022 13:47:55 GMT</pubDate>
    <dc:creator>DSwanich8</dc:creator>
    <dc:date>2022-08-05T13:47:55Z</dc:date>
    <item>
      <title>Checking for - or ' in a name field</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Checking-for-or-in-a-name-field/m-p/676307#M969</link>
      <description>&lt;P&gt;Has any one out there used a custom coded workflow to check for an - or ' in their first name, and to capitalise the first letter proceeding the - or '.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We've used the native data format action in a workflow to change all first names and last names to title case. But that's caused issues for the names that contain an - or '.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We can't find anything online to help troubleshoot this. Would be amazing if this use case was added to the&amp;nbsp;&lt;SPAN&gt;Programmable Automation Use Cases ppage.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2022 13:47:55 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Checking-for-or-in-a-name-field/m-p/676307#M969</guid>
      <dc:creator>DSwanich8</dc:creator>
      <dc:date>2022-08-05T13:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: Checking for - or ' in a name field</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Checking-for-or-in-a-name-field/m-p/677786#M975</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/429639"&gt;@DSwanich8&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think the following code could work:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;exports.main = async (event, callback) =&amp;gt; {
  // Pass firstname as a property to include in the code
  let firstname = event.inputFields['firstname'];
  
  // This will turn Lily-mae in Lily-Mae
  if (firstname.includes('-')) {
	const parts = firstname.split('-')
    const firstPart = parts[0]
    let secondPart = parts[1]
    secondPart = secondPart.charAt(0).toUpperCase() + secondPart.slice(1);
    
    firstname = firstPart + secondPart
  } 
  
  // This will turn O'neil into O'Neil
  if (firstname.includes("'")) {
    const parts = firstname.split("'")
    const firstPart = parts[0]
    let secondPart = parts[1]
    secondPart = secondPart.charAt(0).toUpperCase() + secondPart.slice(1);
    
    firstname = firstPart + secondPart
  }

  // Define firstname as an output at the bottom to be able to use the 'copy to property action and save the firstname'
  callback({
    outputFields: {
      firstname: firstname,
    }
  });
}&lt;/LI-CODE&gt;
&lt;P&gt;If you set 'firstname' as an output, you can use the copy to property action to store the firstname for this contact. I did not test this tho, so let me know if you run into any issues.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Aug 2022 11:21:53 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Checking-for-or-in-a-name-field/m-p/677786#M975</guid>
      <dc:creator>Teun</dc:creator>
      <dc:date>2022-08-09T11:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: Checking for - or ' in a name field</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Checking-for-or-in-a-name-field/m-p/833676#M1708</link>
      <description>&lt;P&gt;Hi Teun,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been looking for a solution like this. I do have a question relating to it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What would you do for last name suffixes? For example, "Johnson II"&amp;nbsp;&lt;/P&gt;&lt;P&gt;If they were a junior (Jr) or senior (Sr), that can be changed with your previous code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Sat, 12 Aug 2023 21:15:25 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Checking-for-or-in-a-name-field/m-p/833676#M1708</guid>
      <dc:creator>MSaye</dc:creator>
      <dc:date>2023-08-12T21:15:25Z</dc:date>
    </item>
  </channel>
</rss>

