Redirect() Function (AMPScript or SSJS) Throws Exception Even When Successful
Last updated 13 days ago ·Reference W-7588435 ·Reported By 3 users
In Review
Summary
When using the Redirect() function in Server-Side Javascript (SSJS) or AMPscript in a try ... catch block, the code always throws an exception.
Repro
1. Create a landing page with a try .... catch block (shell below):
<script runat="server" language="javascript">
Platform.Load("core","1.1");
try {
// Enter condition
Redirect("URL",true);
}
catch (err) {
//Enter code
}
2. Publish the page.
When the page is executed, an exception is returned.
Workaround
The following link documents ways to gracefully handle the exception:
https://salesforce.stackexchange.com/questions/311799/ssjs-platform-response-redirect-throws-unknown-error-error-in-application?noredirect=1&lq=1
Reported By (3)
Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.
