<?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: Increasing a custom property 1 for each new created company in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Increasing-a-custom-property-1-for-each-new-created-company/m-p/788811#M63637</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/127074"&gt;@Jaycee_Lewis&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your Hint. I tried to edit the post, but it deos not work.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.hubspot.com/t5/9881-Operations-Hub/Custom-Code-action-not-copying-into-Custum-Property/m-p/437381#M108" target="_blank" rel="noopener"&gt;Here is the link to the article&lt;/A&gt;&amp;nbsp;, where I have found the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Ahmad&lt;/P&gt;</description>
    <pubDate>Tue, 02 May 2023 13:18:10 GMT</pubDate>
    <dc:creator>ASabakji</dc:creator>
    <dc:date>2023-05-02T13:18:10Z</dc:date>
    <item>
      <title>Increasing a custom property 1 for each new created company</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Increasing-a-custom-property-1-for-each-new-created-company/m-p/787164#M63560</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;At the company level, we have a custom field called "Accounts&amp;nbsp;Receivable Number".&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In this field we give each company such an ID for internal use.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We are looking for a way to not do this manually every time we create a new company, because every time we have to search what the last assigned number was from the last company created to increment this number by 1.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For new created companies this number should always increase by 1 automatically, e.g. first company has the number "6000" so the next created company will automatically have the number "6001" and the next then "6002" and so on.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In the HubSpot community I found out that this is possible with Operations Hub and I found the following code, which I can use in a "Custom code" action in my workflow.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But this code was written with an API Key, and API Keys are not available anymore. How can I make this code work with private apps?&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const hubspot = require('@hub
spot/api-client');

exports.main = (event, callback) =&amp;gt; {
callback(processEvent(event));
}

function processEvent(event) {
const hubspotClient = new hubspot.Client({
accessToken: process.env.privateApp
});
let companyId = event.object.objectId;
hubspotClient.crm.companies.basicApi.getById("6727326198", ["account_receivable_number"])
.then(results =&amp;gt; {
let last_order = results.body.properties.company_id;
let current_order = ++last_order;
hubspotClient.crm.companies.basicApi.update(
companyId,
{properties: {["account_receivable_number"]: current_order}}
)
hubspotClient.crm.companies.basicApi.update(
"6727326198",
{properties: {["account_receivable_number"]: current_order}}
)
})&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;Thanks for any suggestions.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2023 10:56:08 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Increasing-a-custom-property-1-for-each-new-created-company/m-p/787164#M63560</guid>
      <dc:creator>ASabakji</dc:creator>
      <dc:date>2023-04-27T10:56:08Z</dc:date>
    </item>
    <item>
      <title>Re: Increasing a custom property 1 for each new created company</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Increasing-a-custom-property-1-for-each-new-created-company/m-p/787881#M63572</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/421421"&gt;@ASabakji&lt;/a&gt;,&amp;nbsp;thanks for reaching out.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Suggestion — it is helpful for the community if you include a link to the post where you sourced this code block from. You can also try tagging the original poster or user. If the post isn't too old, they may be able to provide help with their solution. Either way, seeing the link will be useful.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One question — when you run this code block in its current state, does it return a specific error?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;Jaycee&lt;/P&gt;</description>
      <pubDate>Fri, 28 Apr 2023 19:34:52 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Increasing-a-custom-property-1-for-each-new-created-company/m-p/787881#M63572</guid>
      <dc:creator>Jaycee_Lewis</dc:creator>
      <dc:date>2023-04-28T19:34:52Z</dc:date>
    </item>
    <item>
      <title>Re: Increasing a custom property 1 for each new created company</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Increasing-a-custom-property-1-for-each-new-created-company/m-p/788811#M63637</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/127074"&gt;@Jaycee_Lewis&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your Hint. I tried to edit the post, but it deos not work.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.hubspot.com/t5/9881-Operations-Hub/Custom-Code-action-not-copying-into-Custum-Property/m-p/437381#M108" target="_blank" rel="noopener"&gt;Here is the link to the article&lt;/A&gt;&amp;nbsp;, where I have found the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Ahmad&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 13:18:10 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Increasing-a-custom-property-1-for-each-new-created-company/m-p/788811#M63637</guid>
      <dc:creator>ASabakji</dc:creator>
      <dc:date>2023-05-02T13:18:10Z</dc:date>
    </item>
  </channel>
</rss>

