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. , , ,", "datePublished": "2020-11-30T22:08:42.000Z", "mainEntityOfPage": { "@type": "WebPage", "@id": "https://trailhead.salesforce.com/trailblazer-community/feed/0D54S000009HIA9SAO" }, "image": "https://trailblazers.salesforce.com/ncsphoto/AGHmNbGCib7JEKNZsgq6NsGkpkbvxSEjcZ24U1QlFJjEhmqA13g8nTgpnEK2cC8DppiJ3iBt6z1IRS7nF4g4Fw%3D%3D", "about": [ "#MCExperts", "#MCDeveloper", "#wsproxy", "#ssjs", "#SSJS Script", "#Marketing Cloud Publication Lists" ], "publisher": { "@type": "Organization", "name": "Trailhead", "url": "https://trailhead.salesforce.com", "@id": "https://trailhead.salesforce.com#Organization" }, "author": { "@type": "Person", "name": "Aditya Gollakota", "url": "https://trailblazers.salesforce.com/profileView?u=0053A00000FMwRRQA1", "agentInteractionStatistic": { "@type": "InteractionCounter", "interactionType": "https://schema.org/WriteAction", "userInteractionCount": 7 }, "affiliation": { "@type": "Organization", "name": "News Corp Australia" } }, "interactionStatistic": { "@type": "InteractionCounter", "interactionType": "https://schema.org/LikeAction", "userInteractionCount": 0 }, "comment": [ { "@type": "Comment", "text": "@Grace Call https://trailblazers.salesforce.com/profileView?u=0054S000001vTNqQAM   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.   ", "author": { "@type": "Person", "name": "Shashi Prasad", "url": "https://trailblazers.salesforce.com/profileView?u=0053A00000FSoCcQAL" }, "datePublished": "2022-08-24T15:20:20.000Z" } ] } Skip to main content

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 

@Andrew Ormerod @Ned Atanasovski  

7 条评论
  1. 2022年8月24日 15:20

    @Grace Call 

    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>

0/9000