Skip to main content
edited tags
Link
Jonas Lamberty
  • 10.3k
  • 2
  • 12
  • 23
Source Link

SSJS WSProxy Create BounceEvent

I am Adding new subscriber to marketing cloud from another system. Some of the subscriber are hard bounced and have a number of bouncecount.

I can create subscriber with Active , Held and Unsubscribe. But cannot create subscriber with bounce status.

Thus i am creating subscriber with active status and then logging bounce event. I assume

  1. This will update the subscriber status to bounce
  2. Also the dataview and other system will show the bounce info.

For creating bounce event , i am using wsproxy . This is my code:


<script runat="server" language="JavaScript"> 
  Platform.Load("core", "1.1.1");
  var MID = Platform.Request.GetFormField("MID");
  var BounceCategory = Platform.Request.GetFormField("BounceCategory");
  var BounceType = Platform.Request.GetFormField("BounceType");
  var SubscriberKey = Platform.Request.GetFormField("SubscriberKey");
  var SMTPCode = Platform.Request.GetFormField("SMTPCode");
  var SMTPReason = Platform.Request.GetFormField("SMTPReason");
  var EventType = Platform.Request.GetFormField("EventType");
  try
  {
    var prox = new Script.Util.WSProxy();
    
    prox.resetClientIds();
    prox.setClientId({ "ID": MID });
    var today = new Date();
    var EventDate_ToSet = today.getDate();

 var contentJSON = {
    "Client":{"ID":MID},
    "SubscriberKey":SubscriberKey,
    "EventDate":EventDate_ToSet,
    "SMTPCode":SMTPCode,
    "BounceCategory":BounceCategory,
    "SMTPReason":SMTPReason,
   "BounceType":BounceType,
   "EventType":EventType,
   "CustomerKey":"Test123"
    };
    
    var res = prox.createItem("BounceEvent",contentJSON);
    Write(Stringify(res));
    
  }catch(e)
  {
    var exError ={
      "Error":e
    };
    Write(Stringify(exError));
  }
</script>

When testing this using postman , i am getting following error

{"Error":{"message":"Error executing retrieve call.","description":"ExactTarget.OMM.FunctionExecutionException: Error executing retrieve call.\r\n Error Code: OMM_FUNC_CONTEXT_ERR\r\n - from Jint --> \r\n\r\n --- inner exception 1---\r\n\r\nExactTarget.OMM.InvalidFunctionParameterException: Null filter value supplied.\r\n Error Code: OMM_FUNC_CONTEXT_ERR\r\n - from OMMCommon\r\n\r\n\r\n\r\n"}}

do you know what i am doing wrong.