Identical Custom Code stopped working in a new workflow

We have a workflow that includes a workflow and works flawlessly (query on companies).

The API called is (but this is not so relevant). The major issue where can I have an overview of the differrences between the different version for a specific call.

// Create search criteria
const filter1 = { propertyName: ‘kunnr__c’, operator: ‘EQ’, value: soldto }
const filter2 = { propertyName: ‘sales_organization__c’, operator: ‘EQ’, value: soldtoorganisation }
const filterGroup = { filters: [filter1,filter2] }
const sort = JSON.stringify({ propertyName: ‘createddate_sap__c’, direction: ‘DESCENDING’ })
const properties = [‘createddate_sap__c’]
const limit = 1
const after = 0

const searchCriteria = {
filterGroups: [filterGroup],
sorts: [sort],
properties,
limit,
after
}

hubspotClient.crm.companies.searchApi.doSearch(searchCriteria).then(searchCompanyResponse =>

The custom code is written in node v16 on hubspot client v3 and indeed finds a company in line with the query

When I copy the same code in a new workflow also using hubspot client v3 with the same values no company is any longer found

CollectionResponseWithTotalSimplePublicObject {
 total: undefined,
 results: undefined,
 paging: undefined
} error

As the node version and client are the same I would imagine that it would also return a result.

Hi @mdierckx!
Good afternoon! From my understanding:

  • You have a workflow that has a custom code that queries companies and seems to work fine.
  • The custom code is written in node v16 and uses v3 API endpoints, successfully finding the company in line with the query
  • However, when you copy the same code in a new workflow also using v3 API endpoints with the same values no company is found and you get an “undefined” error.

Based on this similar error reported it could be pointing to an undefined object.
If you have access to workflows, you should have access to technical support on a Professional level account. Have you tried opening up a support ticket?
While it would be out of scope to advise on custom code, support could take a look at the errors in the workflow if there are any or a response error with an API call you’re doing if you provide them with the following:

  • Link to workflow
  • Link to example record that had an issue
  • API endpoint you’re using
  • The API call body
  • The API call header
  • The response
  • If you have a video reproducing the issue
    But I also wanted to extend this query to @Jaycee_Lewis @miljkovicmisa @Humashankar in case you’ve come across this before and have some ideas!
    Thank you,
    Jessie
    Community Moderator