I’m trying to add some custom code into a workflow to search through the properties of a Patient Records custom object I created, but it keeps giving me this error:
TypeError: Cannot read property 'searchApi' of undefined
It looks like I can’t use the search API the same way I do when I’m searching through contacts or deals. What do I need to fix here? (And just to preface this, I’m not a developer, just learning JS as I go)
hubspotClient.crm.patient_records.searchApi.doSearch(publicObjectSearchRequest).then(searchResponse =>{
hubspotClient.crm.contacts.basicApi.update(event.object.objectId, {"properties":{"firstname": searchResponse.body.results[0].first_name, "lastname": searchResponse.body.results[0].last_name}});
});
callback({outputFields: {}});
})
.catch(err => {
console.error(err);
});
}