Custom Field Update not persisting in Database

Hello, I have modified the on_submit section of Sales Invoice to update a custom field that i created on the Sales invoice Doctype, with the result of a function. The field get updated as expected when i submit the invoice, because i can see it in the UI, but if i query the database table directly, the custom field in the invoice table is null and after some time it does not show in the UI, as if it haven’t had commited to the database and i was watching a cached value or something, in the UI.

Have somebody experienced this issue? this does not throw any error at all.

Hi @rpol,

it would be helpful if you could share your code… But I assume you use

cur_frm.set_value("target", value);

This function will write the value in the browser form, but not to the database. You will need to save the content of the form, only this will make it persist. Normally, this is done by the user with the save button…

Hope this helps.

Hi, I’ll try your suggestion.

Thanks for your help!