I have hit a bit of a wall in this. I can create Filter Definitions via the SSJS function and via SSJS and AMPscript and SOAP API calls, but every time I try to create via WSProxy, I get the same error on the 'DataFilter' part of the payload.
- I verified it is not an array it throws the error:
Object of type 'System.Collections.ArrayList' cannot be converted to type 'ExactTarget.Integration.WSDL.FilterPart'.
- I have checked the SOAP objects and 'FilterPart' Object is not an actual object, but instead an abstract base class for the subsets of Objects under it. Such as SimpleFilterPart, ComplexFilterPart, and TagFilterPart
- To keep things simple, I attempted to create a SimpleFilterPart (no pun intended). But if I put it through as an object, using the
{Property:"", SimpleOperator:"", Value:""}
format same as the SOAP object/envelope, it throws the error:Invalid property name: Property
- I attempted to do a retrieve on this via SSJS Function it came back with the following in DataFilter
"DataFilter":"ExactTarget.Integration.WSDL.ComplexFilterPart"
- I have tried deconstructing it via
results[0].DataFilter[i]
or guessing on property names -results[0].DataFilter.Property
etc. and either it ends up null or gives junk results. - Pulling a Retrieve Request via WSProxy returns
"DataFilter":null
despite having this column listed in the retrieve. This is true of Complex or Simple Filters.
I have run out of ideas on how to do this or other avenues to explore to find a solution. Anyone have any ideas?
Below is an example of my current code:
<script runat=server>
var prox = new Script.Util.WSProxy();
var filterDefinition = {
Name: "filterName"
, CustomerKey : "filterName"
, DataSource : {"CustomerKey" : "FilterSource_API" }
, DataFilter : {Property: "MyField", SimpleOperator: "equals", Value: "MyValue"}
};
try {
var results = prox.createItem("FilterDefinition", filterDefinition);
Platform.Response.Write(Platform.Function.Stringify(results));
} catch(e) {
Platform.Response.Write(Platform.Function.Stringify(e));
}
</script>