Hi All,
I've been trying to use WSProxy to dynamically update publication lists in multiple child BU's using an SSJS activity in an Automation.
I've noticed very strange behaviour where the script executes successfully and I'm getting a successful response from the WSProxy API, however the subscriber isn't getting updated in the corresponding Publication List.
In my real automation, I populate a DE with the details of the subscribers who need to be resubscribed and use the DE data as my source for the script activity
Sample code below:
<script runat="server">
Platform.Load("core", "1.1");
var api = new Script.Util.WSProxy();
var buId = nnnnnn;
var listId = llllll;
api.setClientId({"ID": buId});
var options = {
SaveOptions: [{
PropertyName: "*",
SaveAction: "UpdateAdd"
}]
};
try {
var sub = {
SubscriberKey: "SubKey1",
EmailAddress: "xxx@xxx.com.au",
Lists: [{
ID: listId,
Status: "Active"
}]
};
var resp = api.createItem("Subscriber", sub, options);
Write(Stringify(resp));
} catch(e) {
Write(Stringify(e));
}
api.resetClientIds();
</script>
Has anyone else noticed this behaviour in their environment?
I will be raising a case with SF as well, but hopefully someone here has a solution/workaround.
#MCExperts #MCDeveloper #wsproxy, #ssjs, #SSJS Script , #Marketing Cloud Publication Lists
To make the mid dynamic here is the code :
Platform.Recipient.GetAttributeValue('memberid'); //SSJS
What you could have tried - copy the SSJS into a code snippet in the shared folder, call the code snippet in the child BU cloud page or Automation SSSJ script activity.
<script runat="server"> var ampscriptCode = Platform.Function.ContentBlockByID("12345"); </script>