3

I have a cleanup I'm working on and hitting a wall.

We use email address as the subscriber key. I have a few hundred DEs with an "email" column that are NOT marked as sendable. I want to update them to relate to subscriberkey on that email column.

Comparing two DEs that only differ in... sendability... shows that there are at least 3 fields to set:

IsSendable SendableSubscriberField SendableDataExtensionField

I'm pretty decent with SSJS, but it doesn't seem to have the permissions necessary to set these, and my attempts with WSProxy have failed too.

4

The only way to do this programmatically is to use WSProxy to update the DataExtension object. You are right, you need to update those three fields.

Here is an example call that will update a single Data Extension:

<script runat="server">  
Platform.Load("core","1.1.5");  
try{
var prox = new Script.Util.WSProxy(); 

var CustomerKey = "xxxxx-xxxx-xxxx-xxxx", //Insert DE External Key
    IsSendable = "true",
    SendableDataExtensionField = {"Name": "email", "DataType": "EmailAddress"}, //"Name" should be the name of the field holding the email address
    SendableSubscriberField = {"Name": "Subscriber Key"}; //Use "Subscriber Key" or "Email Address" dependig on whethrer the SUBSCRIBER_KEY business rule has been turned on.

var res = prox.updateItem("DataExtension", {"CustomerKey":CustomerKey, "IsSendable":IsSendable, "SendableDataExtensionField":SendableDataExtensionField, "SendableSubscriberField":SendableSubscriberField});
Write(Stringify(res));  

}catch(e){
Write(Stringify(e));
}
</script>

Note, that you will need to use updateBatch instead of updateItem to do a bulk update and the second parameter will need to be passed in as an Array of objects instead of a single item.


EDIT

I have written a blog post describing above, plus the method to update multiple Data Extensions in one batch: https://sfmarketing.cloud/?p=923

  • Hey, this worked! I was beginning to worry it wasn't possible. Thanks so much. Now to figure out the array formatting for updateBatch. – JMarcus Nov 14 '19 at 21:39
  • 1
    Glad it worked :-) I linked an example of createBatch in my answer, the structure will be the same for updateBatch. – zuzannamj Nov 14 '19 at 21:42
  • FYI For anyone in the future, I think part of my problem was trying to set SendableSubscriberField.name to "Subscriber_Key" instead of "Subscriber Key". If you pull a DE to see the value it will return Subscriber_Key. I used this code EXACTLY and it worked perfectly. – JMarcus Nov 14 '19 at 21:51

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.