Push Script for updating the value in another document

I am looking for push script to update a value in a previous document from a current document. To explain - We are using the hosted version of ERP Next and so only custom java scripts can be used for customization.
We have process flow from opportunity to quotation to sales order. Once sales order is submitted, we would like to update the source opportunity custom field as “order processed”. this field is allowable on submit.
As per the concept, we believe it has to be done via a custom script by pushing the value from sales order. But please help us how to do it. (I am a bit weak in development ).

The best way to do this would be to add this in the on_update event of Sales Order.

There is already a method for this but it is not called (?)

Please create a GitHub Issue for this and follow up with @neilLasrado - we will fix it in v5.


As i told you, i am bit weak in the technical side. :). Can i Copy paste this script in the custom script as it is? Or should I update the document names and i can make it work? I am posting it as per your comment in the Github issues.

This needs to be done on the server side. We will fix it with version 5.