I have the following function, which updates the User Initiated Send definition to a new Data Extension. I would like to know how to update the email name too for the User Initiated Send to target a new email dynamically.

function runUIS(UISKey,DEName){
            var deESD = Send.Definition.Init(UISKey);
            var updatestatus = deESD.Update({"DataExtensionKey":"SendDE","XXXX":"EmailName"});

I have tried various object names (for XXXX): Email | EmailKey | Message | MessageKey | EmailSendKey | EmailSend | ESD | EmailMessage and none of them seem to work.

The wiki page doesn't tell what this value is either: http://help.exacttarget.com/en/documentation/exacttarget/content/server_side_javascript/server_side_javascript_syntax_guide/send_server_side_javascript_functions/

Does anyone know what the object name might be, or how to find it?

  • I don't think you are going to be able to update the EmailName using the Send.Definition object. The Email Name comes from the Email object so you would need to update it directly. The Send.Definition object references that object using the ID/CustomerKey. Are you trying to actually change the email that is being sent with that definition? – Mac Aug 26 '15 at 18:20
  • Hi Mac. Yes that's exactly right. I don't need to update the email name itself, just updated the User Initiated Send definition to target a new email to send to. – Christopher Carswell Aug 27 '15 at 7:17

In order to update the Email, the property EmailID needs to be used. The email name is not a unique field so it can't be used to reference an email.

var deESD = Send.Definition.Init(UISKey);
var updatestatus = deESD.Update({"DataExtensionKey":"SendDE","EmailID":"111111"});
  • Thanks, Mac! I had actually discovered this myself an hour ago just by trial and error. What should also be included here is that the EmailID can be found with the following function: function findEmailID(emailName){ var results = Email.Retrieve({Property:"Name",SimpleOperator:"equals",Value:emailName}); var emailID = results[0].ID; // returns numeric value } – Christopher Carswell Aug 27 '15 at 14:24
  • @mac it is possible to pass the value to profile attributes using above code – Ravi.A Sep 12 '18 at 10:14
  • It is not possible to pass profile attributes using the above code. The profile attributes come from the subscriber record, not the send definition. It isn't possible to set a profile attribute at the definition level. – Mac Sep 12 '18 at 15:33

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.