How To Inject Data In WebView Templates Of DocType

When we build doctypes, having webview, we get an html having jinja tempelate and js file to tweak around the functiionality from the client side. In html fie, that doc is automatically injected and we can use it like { % field_name % }.

But what is the right way to inject other data for eg, by calling through external APIs, by getting some other data from database, by calling other frappe methods from the DocType Controller.

I can’t find much on Frappe Documentation for the best way to do it.