We need to create a record in a Salesforce [Sales Cloud] Custom Object each time an email is sent from a Sent Email Activity in Journey Builder.
We've added an SSJS script in the email to retrieve an OAuth access token from Salesforce then make a POST request using the Salesforce REST API and the SSJS Post() function.
This is working well; when an email is sent, the record is created in Salesforce. However, we are seeing two records created each time an email is sent. It appears that the SSJS script is being executed twice by the Email send engine.
Has anyone else experienced this and is there a workaround?