2

I'm creating a filter definition through the api, on an enterprise 2 account. When I add a datasource from a data extension object it works fine, but when I add a null datasource to indicate list attributes, I get the following:

Status Message: The DataFilter that was provided is invalid.
Error Code: 373009

This is my entire code for the method. I have also removed the datasource declaration. That doesn't help

string Status = String.Empty;
string Message = String.Empty;
string RequestID = String.Empty;

try
{
    // Create Filter
    FilterDefinition fd = new FilterDefinition();
    fd.DataSource = new SubscriberList();
    fd.DataSource.CustomerKey = "All Subscribers";
    fd.Name = "Test Filter1";
    fd.CustomerKey = "Test_Filter1";
    fd.Description = "description";

    SimpleFilterPart sp1 = new SimpleFilterPart();
    sp1.Property = "Status";
    sp1.SimpleOperator = SimpleOperators.equals;
    sp1.Value = new String[] { "Active" };

    fd.DataFilter = sp1;

    // Execute CreateRequest
    CreateResult[] results = null;

    results = client.Create(null, new APIObject[] { fd }, out RequestID, out Status);

    foreach (CreateResult cr in results)
    {
        lblMessage.Text += "Status Message: " + cr.StatusMessage;
        lblMessage.Text += "
"; lblMessage.Text += "Error Code: " + cr.ErrorCode; lblMessage.Text += "
"; } } catch (Exception exc) { //Set Message lblMessage.Text += "ERROR: " + exc.Message; }

Any help would be good. I even though of doing a retrieve of an already created filter, but when retrieving the datasource, I get an error that it's out of bound of the array.

Thanks

1

1 Answer 1

1

The DataSource needs to be specified as a SubscriberList object. In all accounts, there is a list called "All Subscribers" which is the master list that contains all of the records. This list can be used:

FilterDefinition fd = new FilterDefinition();
fd.DataSource = new SubscriberList();
fd.DataSource.CustomerKey = "All Subscribers";
3
  • Thanks Mac for the speedy reply. I tried that, No luck. I have added the entire code for the method, if that helps
    – Themba
    Commented Apr 16, 2015 at 15:09
  • I see the issue now. It is trying to filter on Status which isn't valid for a filter. Only profile attributes, not system-level fields like Status. If you change "Status" in your call with a valid profile attribute, does it work?
    – Mac
    Commented Apr 16, 2015 at 19:03
  • That's amazing. It works perfectly
    – Themba
    Commented May 5, 2015 at 19:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .