<?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: Replacing Dates Portions of a Name in Data Hub</title>
    <link>https://community.hubspot.com/t5/Data-Hub/Replacing-Dates-Portions-of-a-Name/m-p/798266#M1536</link>
    <description>&lt;P&gt;I got ya! Thanks.&lt;/P&gt;</description>
    <pubDate>Wed, 24 May 2023 12:49:24 GMT</pubDate>
    <dc:creator>MCallies</dc:creator>
    <dc:date>2023-05-24T12:49:24Z</dc:date>
    <item>
      <title>Replacing Dates Portions of a Name</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Replacing-Dates-Portions-of-a-Name/m-p/795067#M1509</link>
      <description>&lt;P&gt;Okay, I'm looking to replace just a portion of a name and then populate it with something else. Essentially, at the end of our deal names, we have the create month and year of the deal, when a new renewal deal is created, I want to keep the name of the deal but replace the create month and deal with the renewal deal create month and year.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;Deal Name - 01/21&lt;/P&gt;&lt;P&gt;and I want it to update to&lt;/P&gt;&lt;P&gt;Deal Name - 04/23&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tried a few options in OpsHub, but can't get anything to stick. Any suggestions from anyone doing something similar?&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 16:03:20 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Replacing-Dates-Portions-of-a-Name/m-p/795067#M1509</guid>
      <dc:creator>MCallies</dc:creator>
      <dc:date>2023-05-17T16:03:20Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing Dates Portions of a Name</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Replacing-Dates-Portions-of-a-Name/m-p/795069#M1510</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/357795"&gt;@MCallies&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this is a one-time effort, have you considered exporting your deals, making the name change in Excel quickly (using text to columns, for example), then re-importing the deals based on the record ID?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards!&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 16:06:21 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Replacing-Dates-Portions-of-a-Name/m-p/795069#M1510</guid>
      <dc:creator>karstenkoehler</dc:creator>
      <dc:date>2023-05-17T16:06:21Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing Dates Portions of a Name</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Replacing-Dates-Portions-of-a-Name/m-p/795077#M1511</link>
      <description>&lt;P&gt;Unfortunately not a one time thing, basically looking to set a workflow, so 90 days prior to deal expiring, a renewal deal is automatically created and the new info replaces the old.&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 16:11:21 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Replacing-Dates-Portions-of-a-Name/m-p/795077#M1511</guid>
      <dc:creator>MCallies</dc:creator>
      <dc:date>2023-05-17T16:11:21Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing Dates Portions of a Name</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Replacing-Dates-Portions-of-a-Name/m-p/795964#M1523</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/357795"&gt;@MCallies&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Should be pretty straightforward to generate the new name:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;exports.main = async (event, callback) =&amp;gt; {
var dealname = event.inputFields['dealname'];
dealname = dealname.split(' - ')[0];
var newcreatedate = new Date();
newcreatedate = new Intl.DateTimeFormat('en-GB', {year: "2-digit", month: "2-digit",}).format(newcreatedate);
var newdealname = dealname + ' - '+newcreatedate
  
  callback({
    outputFields: {
      newdealname: newdealname
    }
  });
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This presumes you want to set the new date to the current date. If you're looking to set it as when the renewal date is actually due it might be a slightly different approach. Presuming it's 90 days from when the workflow is triggered you could just add 90 days to the date by adding this line:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;newcreatedate.setDate(newcreatedate.getDate() + 90)&lt;/LI-CODE&gt;&lt;P&gt;Then you can use the outputted 'newdealname' to either create a new record or update the existing record depending on what you want to achieve.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is presuming that all of your deal names have the exact same structure of format to them, ie the deal name and date is separate by a ' - ' every time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if any of this is unclear.&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2023 22:20:06 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Replacing-Dates-Portions-of-a-Name/m-p/795964#M1523</guid>
      <dc:creator>KimM</dc:creator>
      <dc:date>2023-05-18T22:20:06Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing Dates Portions of a Name</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Replacing-Dates-Portions-of-a-Name/m-p/798266#M1536</link>
      <description>&lt;P&gt;I got ya! Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2023 12:49:24 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Replacing-Dates-Portions-of-a-Name/m-p/798266#M1536</guid>
      <dc:creator>MCallies</dc:creator>
      <dc:date>2023-05-24T12:49:24Z</dc:date>
    </item>
  </channel>
</rss>

