Forum Discussion

jpierlot's avatar
7 years ago

Auto fill the registration_ID once receiving partially registrered email

Hi,

I work on a Community where I want to import users through API or a CSV file. Once a user is pre-created, he receives an email to complete his registration (import partially registered user created template in the Studio email template). In the email (https://XXXXXXX/t5/bizapps/bizappspage/tab/community%3Astudio%3Atext-editor%3Aemail?email=import_partial_reg_user_created&lang=en), there is a link redirecting the user to the registration page, where he can create his account. 

In this email, there is also a registration_id that the user needs to put in the registration form. We would like to put this registration_ID as a parameter in the registration link so that it is auto-filled on the registration form. 

Would anybody know how to do this?

Thanks in advance,

Julien. 

  • jpierlot When I try the URL <community>/t5/user/userregistrationpage/registration-type/invitation_id I unfortunately get redirected to the landing page, so I have to assume things here (might be something that needs to be enabled somewhere, the "Invititation Code"-Thing?).

    You most likely gonna get a form with a text input, you'll most likely have to code around this and add some custom jQuery logic to fill in the registration ID which you can pass with the URL from the email, e.g. you would change (in the email template):

    ${emailUrls.getTapestryUrl("/user/userregistrationpage/registration-type/invitation_id")}

    to

    ${emailUrls.getTapestryUrl("/user/userregistrationpage/registration-type/invitation_id")}?reg_id=${user.registrationId}

    the "reg_id" (call it whatever you like) URL parameter could then be read with jQuery/JavaScript and pre-filled into the text-input of the form on that page, something like this:

    var param = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    var reg_id = param[0].split('=')[1];
    
    if ( reg_id.length ) {
        $('<selector.for.text.input>').val(reg_id);
    }

    this is untested code and pretty crude, but should give you a basic idea of what I'm talking about =)...