Thank you both again for the follow-up!
@Shankar_V I know I’ve made a mistake in the original thread-start on the forum by stating the name of the Child Table wrongly. It is Project Information Media Assets and not the one with the underscores (I wanted to change it to the one with the underscores later to see the difference between original DocTypes/Child Tables and the custom-made ones. I left the idea as this change would break the link to the Child Table that is already in use)
When using your suggestion/syntax I think it should be:
frappe.ui.form.on("Project", {
refresh: function(frm,cdt,cdn) {
frm.set_query('Project Information Media Assets','asset_name',function(frm){
return {
filters:{
'asset_category':"Library Media"
}
}
})
}
})
But as stated in an earlier post this does not work and keeps throwing these errors in the console:
script_manager.js:24 ƒ (frm,cdt,cdn) {
frm.set_query('Project Information Media Assets','asset_name',function(frm){
return {
filters:{
'asset_category':"Library Media…
r @ script_manager.js:24
a @ script_manager.js:100
(anonymous) @ script_manager.js:118
Promise.then (async)
(anonymous) @ dom.js:265
frappe.run_serially @ dom.js:263
trigger @ script_manager.js:132
(anonymous) @ form.js:499
Promise.then (async)
(anonymous) @ dom.js:265
frappe.run_serially @ dom.js:263
render_form @ form.js:489
(anonymous) @ form.js:458
Promise.then (async)
initialize_new_doc @ form.js:455
trigger_onload @ form.js:433
refresh @ form.js:330
render @ formview.js:108
(anonymous) @ formview.js:92
callback @ model.js:216
success @ request.js:78
200 @ request.js:122
(anonymous) @ request.js:266
i @ jquery.min.js:2
fireWith @ jquery.min.js:2
z @ jquery.min.js:4
(anonymous) @ jquery.min.js:4
load (async)
send @ jquery.min.js:4
ajax @ jquery.min.js:4
frappe.request.call @ request.js:248
frappe.call @ request.js:98
(anonymous) @ model.js:208
with_doc @ model.js:202
fetch_and_render @ formview.js:81
show_doc @ formview.js:76
make_and_show @ formview.js:32
(anonymous) @ formview.js:15
callback @ model.js:173
success @ request.js:78
200 @ request.js:122
(anonymous) @ request.js:266
i @ jquery.min.js:2
fireWith @ jquery.min.js:2
z @ jquery.min.js:4
(anonymous) @ jquery.min.js:4
load (async)
send @ jquery.min.js:4
ajax @ jquery.min.js:4
frappe.request.call @ request.js:248
frappe.call @ request.js:98
with_doctype @ model.js:147
make @ formview.js:12
show @ factory.js:24
render_page @ router.js:206
render @ router.js:185
route @ router.js:106
set_route @ desk.js:170
startup @ desk.js:69
init @ desk.js:29
frappe.start_app @ desk.js:13
(anonymous) @ desk.js:24
i @ jquery.min.js:2
fireWith @ jquery.min.js:2
ready @ jquery.min.js:2
J @ jquery.min.js:2
form.js:1369 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'grid')
at frappe.ui.form.Form.set_query (form.js:1369:27)
at refresh (project__custom_js:3:13)
at r (script_manager.js:22:12)
at a (script_manager.js:100:16)
at script_manager.js:118:22
When I use the button “Add script for Child Table” on the Client Script page, it starts the added setup also with the name of the chosen Child Table and not the Parent DocType. That is what really confuses me.
As I’m new to this kind of “programming”, I’m trying to figure out how the scripting works. It seems that I don’t have the right skills to handle Custom Scripting in a Child Table as I’m struggling with it quite seriously. Hence another thread on this forum: https://discuss.frappe.io/t/custom-script-help-needed-adding-value-from-main-doctype-in-child-table/87501
Thank you @NCP for the link - as I’m always looking for ERPNext documentation but I seem to forget that I have to look into the Frappe documentation to get any wiser about the core of the system.
I’m quite convinced that both my issues will disappear once I figure out how to handle Custom Scripts, so all your help is really appreciated and more than welcome!