I've created a custom form on a cloudpage with a handler to insert a phone number into a data extension to honor a mobile unsubscribe. Once you enter the phonenumber and press submit, you are redirected to a confirmation page.
My Data extension has a single column called MobileNumber, which is the primarykey.
Everything works, except if you try to enter a duplicate number then you get the 500 error page. I'm guessing that this is due to a primaykey violation.
Is there a way that I can display a message that says, "phone number already exists" opposed to the 500 error page?
SET @MobileNumber = RequestParameter("MobileNumber") InsertData("unsubs", "MobileNumber", @MobileNumber) Redirect("cloudpageurl goes here") ELSE OUTPUTLINE(CONCAT("Wrong reCAPTCHA: ", @Response)) ENDIF