Fetch the Clinical Procedure Template from item code on form

I need to be able to fetch the Clinical Procedure Template using the item code rather than the drop down list on the Patient Appointment form.

At the moment, the item code is fetched when I select the Clinical Procedure Template (using “Fetch from” on the field customization), but I can’t find the way to retrieve the Clinical Procedure when I put the code.

This is the only instance where using the item code is better than using the procedure name, that’s why I added the custom field “Código estudio” to the form. It’s field type is Int.

I’ve tried with a few Customs Scripts without success, using “cur_frm.add_fetch”. I can’t figure out how to compare the data inserted on the custom field in the Patient Appointment form, with the field “item code” on the Clinical Procedure Template doctype to obtain the name of the procedure.