Hi @all,
The use case is to find the trigger point for Not Saved status.
For example when the use edits something in the doctype the status gets changes to Not Saved, on what trigger point we get that?
Regards,
Prasanth
Hi @all,
The use case is to find the trigger point for Not Saved status.
For example when the use edits something in the doctype the status gets changes to Not Saved, on what trigger point we get that?
Regards,
Prasanth
Hi @Prasanth_Kumar_J
You can use frm.dirty()
Set form as âdirtyâ. This is used to set form as dirty when document values are changed. This triggers the âNot Savedâ indicator in the Form Views.
for your reference:-
https://frappeframework.com/docs/user/en/api/form
Hi @Safvan_Ph
thanks for the reply
Already tried with the following code
When we have the changes, then we want this button to be displayed.
if(frm.is_dirty()){
frm.add_custom_button(__(âSave & Submitâ), function(){
if(frm.is_dirty()){
frm.save();
}
sleep(1500).then(() => {
frm.trigger(âbefore_submitâ);
if(frm.doc.status === âReadyâ && !frm.is_dirty()){
frm.trigger(âon_submitâ);
frm.save(âSubmitâ);
}
});
}).css({âcolorâ:âwhiteâ, âbackground-colorâ: â#2490efâ});
}
Please try it.
if(frm.is_dirty()) {
frm.add_custom_button(__('Save & Submit'), function() {
frm.save('Save').then(() => {
// After saving, you can add your additional logic.
if(frm.doc.status === 'Ready') {
frm.trigger('before_submit');
frm.trigger('on_submit');
frm.save('Submit');
}
});
}).css({"color": "white", "background-color": "#2490ef"});
}
Thank You!