0

Is there a way to tell “where” I’m at and how I got there?

I'm writing code to create referral tracking. I have a Client table and a Referral table that have a 1:N relationship. 

On the Client table I have a tab for Referrals and I have two buttons to create the Referred By and the Referral records in the Referral table. 

The Referral table has a view into the Client table so I can connect a client (cRefer) to the current client record (cCurrent). What I have used in the past for other simiar situations is a y/n field in the Client table to indicate that I should attach the cRefer record to the cCurrent. The "attachment" happens with another button in the Referral table and then the y/n field reverts to "No" once the attachment has happened. 

My question is: Is there a way to display the y/n field on the Client form ONLY IF I’m actually doing the referral process (ie, I've hit the Add Referral button on the Client table), and not when I’m creating the a new client record or updating other information via the Client table?

I'm imagining some function that returns how you got to the page so I can do a "If I came from the Referral table, then show, if not do not show" in the y/n field.

Thanks for your help!

Leah

3 replies

null
    • conneenmichael
    • 4 yrs ago
    • Reported - view

    Leah, 

    You can create a field on the Client table.. call it navFromReferal ... and when navigating from Referal table for a specific client.. set that field to true.... 

    But I am not sure I am following your logic..  Above you state .. "(ie, I've hit the Add Referral button on the Client table)"... so not sure why you would not set the value there.. knowing that you are going to the referal.. and then back again. 

    • info.17
    • 4 yrs ago
    • Reported - view

    Yes, of course! Such an obvious solution, but I hit a wall the other day trying to figure it out. Thank you for helping me see the obvious. 

    • info.17
    • 4 yrs ago
    • Reported - view

    FYI - This turned out to be slightly trickier than I first thought. The issue was that I wanted the y/n field to appear in the view for the Referring client...not the client I was actually on. For example:

     

    I'm on Client A's record and I hit the button to add who referred them. The button then creates a new record in the Referral table, updates the referred flag (for Client A) and opens the referral record. The referral record has a view into the client table where I can select which client did the referring. When I select the referring client (Client B), the y/n field is not visible because the referred flag is set to 1 for Client A. Boo!

     

    Since I know the referred flag will only turn on when I've hit the button and it's turned back off once the process is complete, I added the following code to the Display only if for the y/n field:

     

    sum((select Clients).TurnOnReffered) > 0

     

    After I attach the referring client in the referral record, I set the TurnOnReffered back to 0 so the field won't be visible...until I do the next referral. Yay!

Content aside

  • 4 yrs agoLast active
  • 3Replies
  • 1182Views