Doctype : Sales Person has field Employee
Doctype : Employee has field prefered_email
Now in Sales Order, i have added custom field “Sales Person”, now based on Sales Person selection , would like to fetch employee and from employee would like to retrieve prefered_email.
Sales Person – > Employee → prefered_email
Is it possible (have you tried) to do two/second level add fetch, if yes please provide custom client script ?
No need for custom script for the first two fields. Now, as you know each Sales Person has employee mentioned in it.
Assuming your fields are named sales_person, employee, prefered_email:
In Customize Form, as you have mentioned Sales Person in Options of sales_person, similarly mention sales_person.employee in Options of employee so the linked employee will be auto-filled.
For the prefered_email you may have to use a custom script. But still try if something like sales_person.employee.prefered_email works or not. I think it should because Employee mentioned in Sales Person too is a linked document.
In the DocType expand the Employee field and see if there’s an input for fetch_from? If so, then write the sales_person.employee in fetch_from and not in options.