Is there an AMPScript's RaiseError function equivalent in SSJS in Marketing Cloud?
1 Answer
Yes - SSJS also has a 'RaiseError()' function:
Sample:
<script runat="server">
var StatusAndRequestID = [0,0];
var newObject = Platform.Function.InvokeCreate(CreateRequest,StatusAndRequestID,Options);
var status = StatusAndRequestID[0];
var requestID = StatusAndRequestID[1]; if(Result != "OK") {
Platform.Function.RaiseError("Create failed. Ensure your call successfully invoked the Create method.",false,"statusCode","3");
}
</script>
-
2
-
Hi Gortonington/Adam, when i use SSJS: do I have to do the
Platform.Load("Core","1.1.5")
command in order to useWrite("<br>" + Stringify(e))
orRaiseError(..)
? Or is it possible to just include a prefix likePlatform.Function.Write(..)
? I am uncertain how much of a performance aspect it is to load the Core 1.1.5 lib. Therefore i would like to get more insight in that. Jan 8, 2020 at 8:20