• Anthony Inniss 7
  • NEWBIE
  • 0 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
I need to send a notification to Salescloud that an email has been sent or has failed from 
 Marketing cloud on the Email send object.
 
I see the code that has bits and pieces of what I need but I'm not sure if I USE "
 
#Salesforce Developer
IF _messagecontext == 'Send' THEN
" to start the block.
%%[ var @Id, @firstName, @lastName, @email, @subscriberRows, @subscriberRow set @Id = _subscriberKey if RequestParameter("submitted") != true then set @subscriberRows = RetrieveSalesforceObjects( "Contact", "FirstName,LastName,Email", "Id", "=", @Id ) set @subscriberRow = Row(@subscriberRows, 1) set @firstName = Field(@subscriberRow, "FirstName") set @lastName = Field(@subscriberRow, "LastName") set @email = Field(@subscriberRow, "Email") else var @updateRecord set @firstname = RequestParameter("firstname") set @lastName = RequestParameter("lastname") set @email = RequestParameter("email") set @updateRecord = UpdateSingleSalesforceObject( "Contact", @Id, "FirstName", @firstname, "LastName", @lastName, "Email", @email ) endif ]%% <!DOCTYPE html> <html> <body> %%[ if @updateRecord == 1 then ]%% <p>Record Updated</p> %%[ elseif @updateRecord == 0 then ]%% <p>Update Failed</p> %%[ endif ]%% <h2>Update Your Details</h2> <form action="%%=RequestParameter('PAGEURL')=%%" method="post"> <label>First name</label> <input type="text" name="firstname" value="%%=v(@firstName)=%%"> <label>Last name</label> <input type="text" name="lastname" value="%%=v(@lastName)=%%"> <label>Email</label> <input type="text" name="email" value="%%=v(@email)=%%"> <input name="submitted" type="hidden" value="true" /> <input type="submit" value="Submit"> </form> </body> </html>