1

I'm setting up a subscription center. It seems like my code works fine when I open the link from the preview email. It recognizes the subscriber and updates the record without any issue. However, when I send the email for a test, it doesn't recognize the subscriber anymore and doesn't fetch their data. I'm not sure what's going on.

As an additional note, my code was working initially, and suddenly it stopped passing the value. It's very strange.

%%[
    SET @sk = AttributeValue('_subscriberkey')
 
 try
    IF RequestParameter('submitted') == True THEN
        SET @sk = RequestParameter('EmailAddress')
        SET @rowsupdated = UpdateData('pCenterFEMSA',1,
 'EmailAddress', @sk,
 'Nombre', RequestParameter('Nombre'),
 'Apellido', RequestParameter('Apellido'),
 'FechaNacimiento', RequestParameter('FechaNacimiento'),
 'Newsletter', iif(RequestParameter('Newsletter') == 'on', 'True', 'False'),
 'Promociones', iif(RequestParameter('Promociones') == 'on', 'True', 'False'),
 'NuevosLanzamientos', iif(RequestParameter('NuevosLanzamientos') == 'on', 'True', 'False'))
        IF @rowsupdated == 1 THEN
            output(v("<div>Si se logro</div>"))
        ELSE
            output(v("<div>No se logro</div>"))
        ENDIF
    ENDIF
    SET @rows = LookupRows("pCenterFEMSA", "EmailAddress", @sk)
    IF rowcount(@rows) > 0 THEN
        SET @row = row(@rows, 1)
        SET @email = field(@row, "EmailAddress")
        SET @Nombre = field(@row, "Nombre")
        SET @Apellido = field(@row, "Apellido")
        SET @FechaNacimiento = format(field(@row, "FechaNacimiento"), "yyyy-MM-dd")
        SET @Newsletter = field(@row, "Newsletter")
        SET @Promociones = field(@row, "Promociones")
        SET @NuevosLanzamientos = field(@row, "NuevosLanzamientos")
        SET @EmailOptIn = field(@row, "EmailOptIn")
        IF @Newsletter == True THEN
            SET @Newsletter = 'checked'
        ENDIF
        IF @Promociones == True THEN
            SET @Promociones = 'checked'
        ENDIF
        IF @NuevosLanzamientos == True THEN
            SET @NuevosLanzamientos = 'checked'
        ENDIF
    ENDIF
 catch (@exception)
 output(concat("<div>Error: ", @exception.description, "</div>"))
]%%
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Formulario</title>
    </head>

    <body>
        <h2>Ingresa tus datos:</h2>
        <form action="%%=RequestParameter('PAGEURL')=%%" method="post">
            <label for="EmailAddress">Email:</label>
            <br />
            <input
                type="EmailAddress"
                id="EmailAddress"
                name="EmailAddress"
                value="%%=v(@email)=%%"
                required
            />
            <br />
            <label for="Nombre">Nombre:</label>
            <br />
            <input
                type="text"
                id="Nombre"
                name="Nombre"
                value="%%=v(@Nombre)=%%"
            />
            <br />
            <label for="Apellido">Apellido:</label>
            <br />
            <input
                type="text"
                id="Apellido"
                name="Apellido"
                value="%%=v(@Apellido)=%%"
            />
            <br />
            <label for="FechaNacimiento">Fecha de Nacimiento:</label>
            <br />
            <input
                type="date"
                id="FechaNacimiento"
                name="FechaNacimiento"
                value="%%=v(@FechaNacimiento)=%%"
            />
            <br />
            <label for="Newsletter">¿Desea recibir nuestro newsletter?</label>
            <br />
            <input
                type="checkbox"
                id="Newsletter"
                name="Newsletter"
                %%="v(@Newsletter)"
                ="%%"
            />
            <br />
            <label for="Promociones"
                >¿Desea recibir nuestras promociones?</label
            >
            <br />
            <input
                type="checkbox"
                id="Promociones"
                name="Promociones"
                %%="v(@Promociones)"
                ="%%"
            />
            <br />
            <label for="NuevosLanzamientos"
                >¿Desea recibir información sobre nuestros nuevos
                lanzamientos?</label
            >
            <br />
            <input
                type="checkbox"
                id="NuevosLanzamientos"
                name="NuevosLanzamientos"
                %%="v(@NuevosLanzamientos)"
                ="%%"
            />
            <br />
            <br />
            <input name="submitted" type="hidden" value="True" />
            <input type="submit" value="submit" />
        </form>
    </body>
</html>

When opening it from the email preview When opening it from the email preview When opening it from a test email send. When opening it from a test email send.

---Update---

I leave the email with which I send to the landing. Basically, it's just a button with the link to the cloud page. It's not a big deal, I don't understand what's happening :(

enter image description here

5
  • Please describe step by step how you send the test email - do you send against a test subscriber that has all the required info?
    – zuzannamj
    Mar 4 at 19:51
  • Can you share what the link in the email looks like? My first guess is that the value at var-sk isn’t making it through because of the approach taken there. If you’re using a CloudPageURL, you don’t need the AttributeValue function, you can simply have var-sk equal to _subscriberkey. Mar 4 at 21:06
  • Actually, that's how I had the variable, without the AttributeValue function, but I added it, exhausting my options, haha. I left the email I use for the landing. Thanks for the help
    – AskingCore
    Mar 5 at 3:13
  • @AskingCore AMPscript doesn't have try catch statement like what you put in your code...
    – Duc Le
    Mar 5 at 4:17
  • @DucLe Haha, true, it was also part of exhausting my options, and just now that you mention it, I realize it, thanks."
    – AskingCore
    Mar 5 at 15:32

1 Answer 1

1

[1] I was able to sort of replicate the problem - having a CloudPage link go to a page, where it only worked when clicking from within Send Preview, but not when I clicked the link from the test email in my inbox. The issue there turned out to be that extra parameters in the URL was appending a second "?". That could be one thing to verify isn't the problem.

[2] If that doesn't work, there's the redundant option of adding parameters to your CloudPageURL():

%%=CloudPagesURL(14652,'subkey',_subsriberkey)=%%

Then in your landing page:

Set @passed_sk = RequestParameter('subkey')

[3] I doubt this is the problem, but just in case - there are some AMPscript syntax issues in the form field. The code pasted has:

%%="v(@Newsletter)"="%%"
%%="v(@Promociones)"="%%"
%%="v(@NuevosLanzamientos)"="%%"

Hopefully #2 resolves it so that you can move forward.

1
  • 1
    Thank you, the first option worked for me, I just had to use '%%=RedirectTo(CloudPagesURL(14640))=%%' to create a single URL without the utm parameters affecting the link. Thanks for the help
    – AskingCore
    Mar 6 at 4:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .