Created
August 20, 2025 11:43
-
-
Save katydorjee/5576ce4afee54b940f47ed5f9a27da0d to your computer and use it in GitHub Desktop.
ssjs to update all subscribers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script runat="server"> | |
| Platform.Load("core","1.1"); | |
| var prox = new Script.Util.WSProxy(); | |
| var de = DataExtension.Init("my_data_extension"); | |
| var data = de.Rows.Retrieve(); | |
| for (var i = 0; i < data.length; i++) { | |
| var row = data[i]; | |
| try { | |
| var subscriber = { | |
| SubscriberKey: row.SubscriberKey, | |
| EmailAddress: row.EmailAddress, | |
| Status: row.Status | |
| }; | |
| var opts = { | |
| SaveOptions: [{PropertyName: "*", SaveAction: "UpdateAdd"}] | |
| }; | |
| var result = prox.updateItem("Subscriber", subscriber, opts); | |
| Write("SubscriberKey: " + row.SubscriberKey + "<br>"); | |
| Write("Result: " + result.Status + "<br><br>"); | |
| } catch (e) { | |
| Write("Error updating SubscriberKey: " + row.SubscriberKey + "<br>"); | |
| Write("Error message: " + Stringify(e) + "<br><br>"); | |
| } | |
| } | |
| </script> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment