Skip to main content

try{

here ssjs code to update the master profile data extension(that is updating perfectly)

if (result>0){ // after updating I am getting value of result 1.. I have checked that.

Platform.Response.RedirectTo(thankUurl);

}

}catch.......

Issue is that: after I clicked the link in email it's directly redirecting to thank you page with out showing the preference center. If I take out the redirecting code then it's working /updating perfectly. I tried just using text message instead Write ("updated"), but its shown even before updated. How to fix it? I want that redirecting portion to execute after execution of the update. Thanks

2 answers
  1. Mateusz Dąbrowski (mateuszdabrowski.pl) Forum Ambassador
    Oct 1, 2023, 11:44 AM

    Two things:

    1. If you want to process the change on the click and show the thank you or error page right after it, I would consider using a single Cloud Page that has SSJS for processing and, based on the result, displays the appropriate message on the same page. No need for a redirect.

    2. If, due to some business requirements, you need that redirect, you will need to move it out of the try/catch block, as due to a bug, redirect within try/catch errors the page out: https://mateuszdabrowski.pl/docs/ssjs/debugging-ssjs/#global-error-catching 

0/9000