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!

@jiloyssss

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

screenshot:

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?

@jiloyssss

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

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

@rohit_w

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!

@rohit_w

The code works now! Thank You very much!

1 Like