Salesforce Marketing Cloud(精确目标),服务器端Java脚本

时间:2018-03-12 11:25:52

标签: javascript salesforce exacttarget

可以使用服务器端Javascript更改所有订户列表中的订户状态吗?

根据该文件,以下事项应该有效

选入

<script runat=server>
 Platform.Load("core", "1");

 var myList = List.Init("<id of subscriber list>"); 
 var emailAddress = "<address>"; 
 var subscriberKey = "<subscriberKey>"; 


 var subscriber = {
   "Email Address": emailAddress,
   "Subscriber Key": subscriberKey
 };

// v1:     var status = myList.Subscribers.Update(subscriber,"Active");
// v2:     var status = myList.Subscribers.Update(emailAddress,"Active");

</script>

停用

<script runat=server>
 Platform.Load("core", "1");

 var myList = List.Init("<id of subscriber list>"); 
 var emailAddress = "<address>"; 
 var subscriberKey = "<subscriberKey>"; 

 var subscriber = {
   "Email Address": emailAddress,
   "Subscriber Key": subscriberKey
 };

// v1:     var status = myList.Subscribers.Update(subscriber,"Unsubscribed");
// v2:     var status = myList.Subscribers.Update(emailAddress,"Unsubscribed");
</script>

但是,如果我尝试运行任何此代码(在Email studio中的示例电子邮件中),我会收到以下错误

Exception of type 'Jint.Native.JsException' was thrown.
 Line: 2061 Char: 20
 throw "Error updating Subscriber on List."
Exception of type 'Jint.Native.JsException' was thrown.

有什么我可以改变以使其有效吗?这被认为是在起作用吗? 最好的祝福 德克

0 个答案:

没有答案