How to set value of a field on the fly from the Controller (backend) for any doctype?

I have some docfields, which are virtual fields. These virtual fields are getting data populate from different sources.
Now rather than calling an API from the javascript and then filling them up, I want to know how can I fil their value in the backend only so when that Document is passed to the frontend, it already has that value filled in it.F

I can’t find any documentation for such a simple thing to do in Frappe.

Hi @Abhiraj_Tulsyan,

If you haven’t checked then we just share some reference documentation.

I hope this helps.

Thank You!

This is not what i am looking for. Let us say I am hitting different server from my backend and get some value and want to put to some field from backend code.

Tell me that