0

As part of an automated email we have, I made an SSJS script block to update an Email Send Definition (User-Initiated) to target a new data extension. However when we do this, it resets the publication list to 'All Subscribers' instead of the specific one we had. First there's a script which retrieves the name of the new DE (@jobno) then this runs:

<script runat=server>
Platform.Load("Core","1");
var deName = Variable.GetValue("@jobno");
var esd = Send.Definition.Init('OurEmail');
var status = esd.Update({ "DataExtensionKey" : (deName), "PubListKey" : "SpecificPubList" });
</script>

The script successfully updates the data extension, but not the publication list. I am pretty sure PubListKey is the correct parameter because changing it to PublicationListKey or anything else causes the script to error, but when I check the send definition it has updated the data extension but not the publication list.

I suspect this is because the Name of the publication list is not the same as the customer key of it - but there's no way of seeing what this is. I tried using the numeric ID too, but that also didn't work. Does anyone have any pointers?

1 Answer 1

1

Your code looks fine. However, the PubListKey parameter needs to fill with a Publication List customer key value not a Publication List name.

The following here is a fast way to retrieve and get the List customer key.

<script runat="server">
Platform.Load("Core", "1.1.1");
var lists = List.Retrieve({Property:"ListName",SimpleOperator:"equals",Value:"Your publication list name"});
var lstCustKey = lists[0].CustomerKey;
</script>

You must log in to answer this question.

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