Can a relationship field be populated based off of the current user rather than using a dropdown to select?

  • 0
  • 1
  • Question
  • Updated 12 months ago
  • Answered
I have a relationship where one employee has many overtimes. When an employee is signing up for overtime, I have a drop down that lists the users from the employee table. Each employee has a quickbase user field that is linked to them. I want the drop down list to auto select the current user filling in the rest of the relationship fields.
Photo of Marc Nelson

Marc Nelson

  • 322 Points 250 badge 2x thumb

Posted 12 months ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,486 Points 50k badge 2x thumb
The ideal way to do this is to change the key field of the Employees table to be the Userid field. Then, when records are being created in the overtime request table, there will be an option to default it to “current user”
Photo of Marc Nelson

Marc Nelson

  • 322 Points 250 badge 2x thumb
Would I do that in the main table "Employee"? I have a separate table where they are creating records that has a relationship of "Employee has many records"

Also, I seem to get errors when trying to convert the field to Key. If needed, Ill get the text of the error.

Thanks for the help!

Marc
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,486 Points 50k badge 2x thumb
I suggest that you make a copy of the app to practice on. 

Let me know what the error is.  Likely, not all of your employees have a Quick Base userid.  To use that method each Employee needs to have a userid
Photo of Marc Nelson

Marc Nelson

  • 322 Points 250 badge 2x thumb
I copied the application and then removed all of my employees that do not currently have quickbase username. That seemed to do the trick with the Key field and then that also allowed me to set the default as current user. Eventually all employees will have a quickbase username so that should work. Thanks!