1

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?

3

There could be another scenario that would cause your script to fire again. Two come to mind:

  1. Text Version - Make sure you remove the SSJS from the text version of your email.

  2. Message Context - Wrap your SSJS in an AMPScript conditional that checks to make sure the _messageContext is "Send".

Out of curiosity, why do you need to do this? Does the Cloud Connector synchronization not cover your need for SFMC activity data in the Sales Cloud?

| improve this answer | |
  • 1
    Thanks Adam, I didn't think about the text version. We removed the SSJS from the text version of the email and it works fine. Regarding your question. The Cloud Connector (v5 Connector) only allows you to is to import data from Salesforce. The new Data Stream feature is promising as this allows true synchronization, but this is still only updating near-time, not real-time, which is what we require for this specific project. – Eliot Harper Mar 9 '16 at 18:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.