Skip to main content
Question

Auto population of data on form loading

  • March 1, 2017
  • 0 replies
  • 42 views

Hi,

This is my situation, 
I have two tables employee_master and employee_job. In employee_master table, i have userid, empid,name,email.
In employee_job, i have userid,empid,designation,department etc. What i want is, when i load employee_job form, empid should be auto populated from employee_master based on userid(current user). Is there any way to do this without any trigger.

Thanks
This topic has been closed for replies.

Thete us a simple way and a more complicated way.

The simple way,especially if there are no other relationships involving the Employee master table is to change the Key field of the employee master table to the userid.

Note that you may want to Copy your app to try this first.

Then, on your jobs table, you can have a formula field called [Current User] with a formula of User()

Lastly a form rule that says

When the field related armployee is blank change the related employee field to be the value in the field Current User.

Note that the field that the form rule is acting on will be the field which is used in the relationship to the employer table.

  • Registered
  • March 1, 2017
Yes,  The best way, which is also the easiest. is to slightly modify the button you are pushing from the master table.

You probably have a button called "Add Employee Job"  you just need to insert one small line.

Yours might look something like this:

URLRoot() & "db/" & [_DBID_EMPLOYEE_JOBS] & "?a=API_GenAddRecordForm&_fid_12=" & URLEncode ([Record ID#])& "&z=" & Rurl()

Just add another fid to be written to:
You can copy the format of part of the code:  &_fid_12=" & URLEncode ([Record ID#])& "

Change the fid from 12 to the field id that has your "empid" then if it is a user insert (User())
Like this:

&_fid_12=" & URLEncode (User())& "

#NoCodeRequired