Autofill for Custom Read Only Fields during Data Import

Hi,

I’ve created 4 new fields in the Attendance Module.

Work In, Work Out (which I set to Read Only and retrieve using the following script)

// set work_in field to work_in value from employee link field
// function add_fetch(link_fieldname, source_fieldname, target_fieldname)
cur_frm.add_fetch(‘employee’,‘work_in’,‘work_in’)
cur_frm.add_fetch(‘employee’,‘work_out’,‘work_out’)

Time In, Time Out (which I plan to import from my biometrics system).

My question is that every time I import, the Work In, Work Out fields do not immediately autofill - just stays blank. I want to discourage placing this in the import file since it gives the user a change to modify the intended time an employee is expected to be at work.

How do I have my read only fields autofill every time I upload?

If I am getting your use case then it is I guess this :-

  1. Every employee has a expected in time and out time.
  2. You want to fetch from that Employee’s record his/her in and out time in their attendance record. Then try this.

In the options of these two fields work_in and work_out, you need to do this :-

This is how I am expecting your employee field in attendance is :

Now using employee do this: (I’m assuming the work_in and work_out are already fields in Employee doctype and have been populated before you are making this attendance)

Assume time_in and time_out serve the same purpose as your two variables.

Please try this.

Thanks for the reply. I’m not quite sure I understand but this is my current setup:

When I enter the data for Employee, the Employee Name, Work In, and Work Out autofill from the Employee module.

2

If data is placed into the system one by one, things are fine.

However, when I use the Data Import Tool to import my daily attendance, these fields are left blank.

Here is my setup in the Customization:

I want the autofill to still run even if I import the data instead of manually encoding them.

Have you checked Submit after Importing option when trying to import data ? Try it and see if it works or not