Autopopoulate to current User

  • 0
  • 1
  • Question
  • Updated 1 year ago
  • In Progress
Little background:
Each Employee can submit multiple tasks. (Relationship between Employee table and Task Table)
The employee table has all employee details, name, emailid,etc. The key for this table is RecordID.

What am I trying to achieve?
Every time a new task is created, default the Task owner to the current user but also build in logic where the current user could be re-assigning the task to some other employee.
(on Task Form load, default the task owner to the current user and allow the user to choose from a dropdown of other employees)
Photo of Angel

Angel

  • 724 Points 500 badge 2x thumb

Posted 1 year ago

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

QuickBaseCoach App Dev./Training, Champion

  • 51,296 Points 50k badge 2x thumb
I suggest changing the Key field of the employees table to be the user field.

Then make a relationship where 1 EE has many Tasks based on the user field on the task record.

You will either be able to default that field to be the current user or at worst have a form rule ot set it to the current user when it is blank.
Photo of Angel

Angel

  • 724 Points 500 badge 2x thumb
Any ideas, if there a way we could achieve the same without changing the key?

Any inputs are appreciated. thanksĀ 
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,296 Points 50k badge 2x thumb
Well, my best suggestion is to make a copy if the app and try changing the key field. Then if you are OK with the result, make the same change in your live app.

There may be another way without resorting to actual script, but it gets a bit convoluted.

You could set up a cross reference table of employee Record IDs to userid's. Set the key field to be the userid.

Then set up a saved table to table import to copy across the employee records to the cross ref table where the userid is not blank.

Then set up a relationship between the cross ref table and the task table based in the userid field in Tasks.

Lookup the record ID number if the employee.

Use that to be in a relationship to lookup employee information from the EE table.

Set up a Webhook to rerun the import table when any EE record is edited.

It's a pretty convoluted solution.