Understanding Connecting Records

Hello everyone, I have what I hope are a few simple questions for the pros but for me it has me stumped. Here is what I am trying to do:

I want to provide custom links to the sign up page my members can use to share with other people to join our community. I know how to do this conceptually thanks to this article but I need to understand more deeply. Following the article, when the new person signs up, the referer’s code would be added to the new user’s object along with their name, password, email, etc. So here are my questions:

  1. For the referral code, do you recommend I use the referer’s record ID or simply generate an incremental unique number?

  2. Now here is where I get really confused. How do I make this useful? Example, I would love for the person who shared their link to new members to be able to see all of their referrals. But I’m confused on the connection scheme. Can this happen within the same object connection, or would it be smarter to have two objects (Users & Referers)?

  3. Lastly, when designing the page where a referrer can see all of their referrals only, how would you recommend doing this?

Thank you so much for your input/recommendations. I appreciate you helping me.

Scott

Hi @4az.com,

You definitely found a great article to address this, but if you want referrers to have more than one link, you might consider this different approach which you can view in the video below:

In the video I mention a small slice of code which you can reference below.
This helps to create dynamic referral link URLs.

$(document).on('knack-view-render.view_xx', function (event, view, data) {

  referralLinkField = 'field_yy'; // Your referral link field key
  sceneHash = 'insert-sign-up-url-here'; // Your sign up page URL

  // Loop through each referral link field
  $(`#${view.key} .${referralLinkField} a`).each(function() {

    const recordId = $(this).closest('tr').attr('id'); // Get the row's record ID
    $(this).attr('href', Knack.url_base + '#' + sceneHash + '/' + recordId); // Change the URL of the link
    
  });

});

Let me know if you have any questions!

1 Like

Wow @StephenChapman thank you so much for taking the time to give me such a complete answer. I will certainly dig into this and let you know if I have any other questions. If I get stumped, let me know if there is a way to hire you for help. I might need some other guidance on another issues too. Getting expert help defintely saves time. Thank you again!

Scott

1 Like