When selecting the field “assigned_driver”, I need to set values of multiple fields, but each field is link for different doctype. That is why I decided to use the event trigger based on changed field (the selected one), because I need to do more than one thing (multiple settings).
When I am using cur_frm.add_fetch(‘assigned_driver’, ‘employee_name’, ‘driver_name’) out of the trigger, it is working fine and that is normally. What is the equivalent for it that let me set the value of the field driver_name under the trigger event?
OK, I think that I found the solution.
As I see, it is possible to use both:
It is possible to use add_fetch and to use the trigger event when selecting the field.
So I can set the values of other fields using the event and I can set the value of the field that is related to the link using the add_fetch.
But I have another question which is related to this post:
I have a field called vehicle which is link to vehicle, and in the vehicle doctype, there is driver field.
What is the best way to set the vehicle field to right vehicle when the user select the driver field?
In other words:
At vehicle doctype, there is a document name Vehicle1 and inside it the driver is Driver1, I need to assign the vehicle field at doctype trip order when selecting the driver.