/** * HubSpot will display an error when you paste this code, but it actually * works if you ignore it and just save it. * Workflow action to create a new deal on the same close date every month * The date has to be 1st - 28th. * If the date is 29th - 31st, the dates will be off at some point. * * Also, watch your API limit. This custom action calls the API 3 times everytime it runs. */ exports.main = async(event, callback) = > {
// Associate the new deal with the company that was originally associated with constnewDealId = res.body.id constassociations = awaithubspotClient.crm.deals.associationsApi.getAll(dealId, 'companies') if (associations.body.results.length > 0) { awaithubspotClient.crm.deals.associationsApi.create(newDealId, 'companies', associations.body.results[0].id, 'deal_to_company') }