Table fields and values

Hello Everyone,

Facing this problem and hope to get a solution soon.
I have a table Rooms and a child services_room (Service, description, qtd, total).
When I select Service (list of services) I would like to get the description and price and add to Descrition and price fields on the child table. I have tried the following code but is not triggered or does not happen at all
frappe.ui.form.on(“Service_room”,“nome_servico”,function(frm,cdt,cdn){
var d = locals[cdt][cdn]

msgprint (d)

});

How to trigger the action when I select the dropdown ?

You are doing right. Just make sure you are using correct name child doctype (case sensitive) and the fieldname on which it will be triggered.

@nabinhait Thanks for the support … but really not working … here the real names …
Doctype GESTAO_QUARTOS
field servicos as Table with RESERVAS_Services

Doctype RESERVAS_Services
fields nome_servico as link SERVICOS
descricao

Doctype SERVICOS
fields nome, descricao, price

so on my GESTAO_QUARTOS.JS created
frappe.ui.form.on(“RESERVAS_Services”,“nome_servico”,function(frm,cdt,cdn){
var d = locals[cdt][cdn]
msgprint (d)

But still not getting anything … any other way to debug this or how can I see if this function is triggered ?

Is there any error message in the browser console?

Was following one of your solutions … and went to check on console …for some reason started working now just checking the values.
Another error that happens a lot is when you first select the dropdown and select the item … the values from other fields are not returned… like select user 0001 the value for name should show but does not and you have to delete the selection and search again … only this time the records are shown.

@nabinhait I have it working now. Thanks
Some other issues are as I said before… When selecting the first time and using cur_frm_fetch it does not return the value… Only after I delete and select again!
Also how to refresh the fields on the grid?

@nabinhait Once again thanks and we can close this.
I have also managed to find how to disable the field on the child grid … after debugging a bit :slight_smile:

frappe.utils.filter_dict(frm.fields_dict[“servicos”].grid.docfields, {“fieldname”: “preco_servico”})[0].read_only = true;