Frappe.web_form.set_value doesn't work in controller js

I tried to set value for fields by using script in the js file of the web form but it doesn;t work.
When I move the same script to the client script section of the webform it works.
Other pasrt of the script works in both places.
Does the controller need special treatment or is there a bug?

The set_value actually works.
What didn’t work was when getting the value from get_list() or get_doc() or other similar list/value api, because they return null or undefined or [].

I post issue here:
https://github.com/frappe/frappe/issues/10843