/** * 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') }
callback({ outputFields: {} }) }
Join us on March 27th at 12 PM for the Digital Essentials Lab, an interactive session designed to redefine your digital strategy!
Engage with expert Jourdan Guyton to gain actionable insights, participate in live Q&A, and learn strategies to boost your business success. Don't miss this opportunity to connect and grow—reserve your spot today!