Fetch details based on selection

Hi All,
I have added a new custom field with Link data type pointing to Contact doctype.
in that form, I need to show the agent email as soon as i select the agent from the custom field.

i have tried adding code to fetch filed but no success.

Can anybody suggest a solution.

Thank you,
Ramaly

@ramalyb are you sure about the agent contact fieldname ?

Hi @bahaou yes, please find below,