Form triggers with small custom script

Update

After a lot of googling …
Credit also to other people that posted code on the group, such as this one …

Still a bit in the dark about triggers, but there is light at the end of the tunnel.
I think what I am battling a bit is the terms used …
“load” and “render” what does that imply? During the “construction” of the page that
is viewed by the user , a few things are happening … starting with the doctype and also
considering any customisations that is in the system for that form … loading data … and ending up
with the page as viewed. And some of those processes are called “loading” and
“rendering” and to make sense of all this, is key.

Currently testing code that seem to be working well that triggers on “refresh”.
It does use , like the posting above, the “frappe.client.get_value” call, and not add_fetch.
It works both in the case of opening the “auto-created” job card and when you create
your own job card from the work-order.

With the “add_fetch” it always worked when the “work order” field was modified. But to auto-fetch
existing data , it seems that the best is to do one’s own fetching.I tried “frappe.db.get_value” as well
but couldn’t get that to work. Perhaps I must find some time to revisit that one , now that
“frappe.client.get_value” is working.

So “add_fetch” is more geared towards a field being modified …???

Here is a nice doc I found …

(https://github.com/frappe/frappe/wiki/Developer-Cheatsheet)

Making small progress.