We have an email that will be sent to a list once a week. That email pulls in outside xml feed of current product info.

Automating this is easy but what if I want to stop the email send for a given week because there is no new xml data? (without manually going into the UI and pausing the schedule.)

a) if I populate a general data extension with a bit value (1 or 0) can I query that value in the automation to send or not send to a list?

b) I thought I could negate the UI automation and just do an API send to a list according to my own server schedule. Then I could use my own server side script to determine if an email should be sent that week to the list. -My Problem is I can't find API code that lets me send a specific email to a specific list. I only see triggered sends that sends to subscribers one-by-one.

I don't favor one idea over the other. I simply don't see away to dynamically SEND/NOT SEND to a list without updating a field for each individual subscriber.

Any input is appreciated.

  • Sorry - I thought this questioned was answered, but it seems as though maybe not? There are a couple of different ways to approach this - both of the above could work. It really depends on what fits into your overall solution. Let me know what you would like to do, and I can get you a solution. – Kelly J Andrews Jan 2 '14 at 22:20

You could create a custom setting (Setup > Develop > Custom Settings) that would allow you to turn on/off the email for the week before sending. The code might start out like this:

global class SendMessages implements Database.Batchable<SObject>, Database.Scheduleable {
    integer queryLimit;
    global SendMessages() {
        queryLimit = Test.isRunningTest()? 200: (SendMessages__c.getOrgDefaults().SendMessages__c? 0: 50000000);
    // Your other code here

This constructor will set the query limit to 0 if no message is to be sent, 200 if it is a test method call, and 50,000,000 otherwise. This would allow you to keep the schedule and send the message weekly as appropriate.

  • Sorry, maybe I need to clarify more or maybe I'm in the wrong forum. But the context for this question is with regard to using Soap API call to Exact Target or using a built-in ExactTarget automation tool. I don't know that the navigation option you shared is available in ET. I'm looking for help with a PHP Soap API call to ET or clarification on existing ET tools. Thanks for trying. – Jason Dec 23 '13 at 18:59
  • @user4994 The answers provided here would be specifically related to salesforce.com; if you were integrating SFDC with ET, then this would be a valid question for SFSE. In the spirit of trying, though, you might look at Creating Email Send Definition – sfdcfox Dec 23 '13 at 19:52

You can create a custom webservice method that your server could call to kick off the batch class that sends emails. This reduces the number of API calls you need to two (one to log in, one to kick off the batch process).

global class BatchStart {
    global webservice void sendEmails() {
        Database.executeBatch(new SendMessages());

You could use a custom object with a long text area to store the previous week's XML data (assuming you're gathering it from a resource in Apex Code), query that XML data and compare it to the current week's XML data, and if they are equal, not call the batch class. It might look like this:

global void execute(Database.SchedulableContext sc) {
    String thisWeekData = RemoteCall.getXMLData();
    try {
        XML_Data__c lastWeek = [SELECT Id, XML_Data__c FROM XML_Data__c ORDER BY CreatedDate DESC LIMIT 1];
        if(lastWeek.XML_Data__c == thisWeekData) {
    } catch(exception e) { /* Ignore query error */ }
    // Assume we have constructor to store data
    Database.executeBatch(new SendMessages(thisWeekData));

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.