Custom script to change Contact person in Sales Invoice


I have a custom script to change the Contact Person in a Sales Invoice.

I works, but due to some problem (cache?) whenever I choose Menu->Email the email address from the old contact is selected. (Even after Save)

(Tested on the server)

How can avoid this?

Please share your custom script.

Hi, Thank you for responding.

I did a workaround so the problem is not applicable any more.
But it was nothing special, jut like

cur_frm.cscript.custom_validate = function(doc) {
     doc.contact_person = "<Some predefined existing contact for that customer>"