How do I get the value of a settings DocType like the paypal_settings on client side?
I know that the values are in tabSingles but when using frappe.db.get_value it tells me that the DocType “Singles” doesn’t exist.
Hi you can try use frappe.db.sql("""select doctype,field, value from tabSingles""")
Thanks for your reply, but I was asking how to get these values on the client side with javascript.
it is problem to you use frappe.call
from js and use my answer in python? and as I know in js is using this way frappe.model.get_value(doctype, name, fieldname);
but I don’t think that it will work with Singles
You can do this
frappe.model.get_value('Print Settings', {'name': 'Print Settings'}, 'pdf_page_size',
function(d) {
console.log(d)
})
@SwitsolAG
Thanks, but I was looking for a more inbuilt solution.
@netchampfaris
Thanks you, I’ll try this. Is there a way to get more values with one call?
This is not working for custom single DocTypes or singles like “Naming Series”.
Is there a way to prefill the js “locals” object with more DocTypes?
Try this:
var doctype = "Naming Series";
frappe.model.with_doc(doctype, doctype, function() {
var values = frappe.model.get_list(doctype);
}
This will throw an error when the current user doesn’t have the right permissions to view the DocType. Guess I will have to go with frappe.call and use a custom sql statement.
This topic was automatically closed after 24 hours. New replies are no longer allowed.