How to fetch values from Hub Settings

I want to fetch values from Hub Settings. Is there a way to do it? It is for a specific print format, I want to fetch a value from there and display it in the print format. Please help!


Did your created server side print format? If yes then use below code to fetch data from hub settings
frappe.db.get_value('Hub Settings', None, 'fieldname')

Thanks for the reply @rohit_w


I want to get the value of field labeled Company. I used this code:
frappe.db.get_value(‘Hub Settings’, None, ‘company’)
but it returns None value. The Company field has a value. Any idea?


This should work, did you write code inside the curly braces like

{{ frappe.db.get_value("Hub Settings", None, "company") }} 


I already did but it still displays None value. There is no error especially in the syntax but I don’t know why it still displays None value. Any fix for this? Thanks!


The code works now! Thank You very much!

1 Like