verified
Restart a Triggered Send DefinitionLearn how to restart a Triggered Send Definition in Salesforce Marketing Cloud (SFMC) with SSJS (server-side JavaScript). Code snippets include WSProxy and Core methods.
Core
var customerKey = "S0M3-GU1D-K3Y-G03SR1G4T-H3R3";
var tsd = TriggeredSend.Init(customerKey);
var result = tsd.Start();
<script runat="server">
Platform.Load("core", "1");
try {
var customerKey = "S0M3-GU1D-K3Y-G03SR1G4T-H3R3";
var tsd = TriggeredSend.Init(customerKey);
var result = tsd.Start();
Write(Stringify(result));
} catch (error) {
Write(Stringify(error));
}
</script>
"OK"
WSProxy
var api = new Script.Util.WSProxy();
var customerKey = "S0M3-GU1D-K3Y-G03SR1G4T-H3R3";
var result = api.updateItem(
"TriggeredSendDefinition",
{
"CustomerKey": customerKey,
"TriggeredSendStatus": "Active"
}
);
<script runat="server">
Platform.Load("core", "1");
var api = new Script.Util.WSProxy();
try {
var customerKey = "S0M3-GU1D-K3Y-G03SR1G4T-H3R3";
var result = api.updateItem(
"TriggeredSendDefinition",
{
"CustomerKey": customerKey,
"TriggeredSendStatus": "Active"
}
);
Write(Stringify(result));
} catch (error) {
Write(Stringify(error));
}
</script>
{
"Status": "OK",
"RequestID": "S0M3-GU1D-K3Y-G03SR1G4T-H3R3",
"Results": [
{
"Object": {
"CustomerKey": "12345",
"Client": null,
"Email": null,
"List": null,
"HeaderContentArea": null,
"FooterContentArea": null,
"SendClassification": null,
"SenderProfile": null,
"DeliveryProfile": null,
"PrivateDomain": null,
"PrivateIP": null,
"ObjectID": null,
"CreatedDate": "0001-01-01T00:00:00.000",
"ModifiedDate": null,
"Name": null,
"Description": null,
"AutoAddSubscribers": false,
"AutoUpdateSubscribers": false,
"BatchInterval": 0,
"FromName": null,
"FromAddress": null,
"BccEmail": null,
"EmailSubject": null,
"DynamicEmailSubject": null,
"IsMultipart": false,
"IsWrapped": false,
"AllowedSlots": 0,
"NewSlotTrigger": 0,
"SendLimit": 0,
"SendWindowOpen": "0001-01-01T00:00:00.000",
"SendWindowClose": "0001-01-01T00:00:00.000",
"SuppressTracking": false,
"Keyword": null,
"IsPlatformObject": false,
"TriggeredSendType": "Continuous",
"TriggeredSendStatus": "Active",
"PartnerKey": null,
"SendWindowDelete": false,
"RefreshContent": false,
"ExclusionFilter": null,
"Priority": null,
"SendSourceCustomerKey": null,
"ExclusionListCollection": null,
"CCEmail": null,
"SendSourceDataExtension": null,
"IsAlwaysOn": false,
"DisableOnEmailBuildError": false,
"KeepExistingEmailSubject": false,
"PreHeader": null,
"ReplyToAddress": null,
"ReplyToDisplayName": null,
"DataSchemas": null,
"TriggeredSendClass": "Standard",
"TriggeredSendSubClass": "Standard",
"TriggeredSendVersionID": 0,
"RequestExpirationSeconds": 0,
"OptionFlags": 0,
"OptionFlagsUpdateMask": 0,
"OptionVersion": 0,
"CategoryID": 0,
"SourceAddressType": "DefaultPrivateIPAddress",
"DomainType": "DefaultDomain",
"HeaderSalutationSource": "Default",
"FooterSalutationSource": "Default",
"IsSendLogging": false,
"InteractionObjectID": null,
"PartnerProperties": null,
"ID": 0,
"Owner": null,
"CorrelationID": null,
"ObjectState": null
},
"UpdateResults": null,
"ParentPropertyName": null,
"StatusCode": "OK",
"StatusMessage": "TriggeredSendDefinition updated",
"OrdinalID": 0,
"ErrorCode": 0,
"RequestID": null,
"ConversationID": null,
"OverallStatusCode": null,
"RequestType": "Synchronous",
"ResultType": null,
"ResultDetailXML": null
}
]
}
Reference
Ressources and references related to the current methods.
Official documentation
SOAP object