Best Practices for Fetching Field Values in Client-Side JS: frappe.db.get_value vs frappe.call

Hi everyone,

I wanted to clarify a point about fetching field values from documents in Frappe client-side JavaScript.

I’ve been wondering:

Is frappe.db.get_value() wrong? Actually, in JavaScript, isn’t it the most efficient way to fetch one or a few fields from a document?

From my understanding:

  • frappe.db.get_value(doctype, name, fieldname) is lightweight and directly fetches only the needed field(s).

  • frappe.call({ method: "frappe.client.get", ... }) is more flexible but heavier since it returns the full document.

  • Using frappe.db.get_value is particularly efficient if you only need one or a few fields, and you can add caching to avoid multiple server hits for the same document.

I’d love to hear from the community:

  • Do you prefer frappe.db.get_value or frappe.call in client scripts?

  • Are there situations where frappe.call is a better choice even for a single field?

Thanks in advance for your insights!