Changing values in Client Script (JS) not saving


I’m running a client side script (JS) to update a field value with the click of a button. This happens flawlessly, the field value gets updated. But after that, I run the .save() code which also runs but I get a toast message saying “Nothing to Save.” Its like the form doesn’t realize that a value has been changed and thus does returns null on save. I have tried adding is_dirty as some users have suggested, but still nothing.

Any ideas?

                frm.doc.status = "Completed";

Hi there,

The problem is that you’re not actually marking the form dirty. frm.is_dirty() is a question, returning true or false based on the state. In contrast, frm.dirty() is a declaration, marking the form dirty.

Also, you might consider using frm.set_value(‘status’, “Completed”), as the method does a better job of handling these kind of hooks.


Thanks so much! such an obvious solution.

1 Like

frm.set_value(‘status’, “Completed”) would UPDATE and SAVE at one go? Or would I need to invoke the save function seprately?