NextGen Knowledge Center

JavaScript Writer Return Values

When you return from your script, you can choose to set a custom Response that will be stored for the destination. The following return values are accepted:

  • String: Any string returned will be stored as the Response content for the destination, with a status of SENT.
  • Status: An instance of the Status enum (for additional information, see The User API (Javadoc)) will cause no response content to be stored, but the connector message status will be updated to SENT, QUEUED, or ERROR depending on the status returned. Note that the status can only be set to QUEUED if queuing is enabled in the Destination Settings.
  • Response: A Response object contains a status, status message, error message, and the actual response content. If this object is returned, all of these things will be stored in the Response content, and the connector message status will be updated accordingly. For additional information, see The User API (Javadoc).
  • Empty String / null / undefined: Returning any of these (including a "return;" statement or no return statement at all) will cause no response data to be stored, and the message status will be updated to SENT.
  • Any Object: Any other object returned will be converted to a String via the toString() method, and that String representation will be stored as the Response data. The message status will also be updated to SENT.