Get_value on child table failing with permission error

I noticed in the recent updates some changes to get_value were made to prevent abuse of child table values through the api (Child table permission error fix by codingCoffee · Pull Request #5311 · frappe/frappe · GitHub).

However, since this update a custom script I have that calls get_value on a custom child table is failing with PermissionError. I’m logged in as Administrator with explicit permissions for the parent. Anyone know how to resolve this?

EDIT: Checked the tabDocType table and the child table has no parent. In fact, no DocTypes have parents… How do I resolve this?

Turns out you need to pass parent through as an argument when calling get_value.

Good day sir, @DBoobis. May i know how did you do this? “Turns out you need to pass parent through as an argument when calling get_value”. I’m having the same error right now. I tried fetching a child table data to other doctype. Thank you in advance. :smiley:

Did you find the solution for this ?

any sample code ??

frappe.db.get_value(“Item Default”, {“parent”: row.item}, “company”, function(value) {

is not working.

frappe.db.get_value(“Logs To Clear”, { ref_doctype: “Error Log” }, “days”, null, “Log Settings”)
.then((r) => {
if (!r.exc && r.message && r.message.days) {
let message = __(“Records are retained for {0} days.”, [

Hope this works!:wink: