The image shows the page is stuck with blurry screen that I couldn’t access the site after I set the workflow state.
Here is my code for implementing this feature
//
before_workflow_action: function(frm) {
if (frm.doc.workflow_state === ‘Saved’) {
pe_posting_date = new Date(frm.doc.posting_date)
if (pe_posting_date.getTime() >= frm.jv_posting_date.getTime()){
console.log(“Posting date is greater than or equal to JV posting date”)
} else {
var formattedDate = frm.jv_posting_date.getFullYear() + ‘-’ +
(frm.jv_posting_date.getMonth() + 1).toString().padStart(2, ‘0’) + ‘-’ +
frm.jv_posting_date.getDate().toString().padStart(2, ‘0’);
frappe.validated = false;
frappe.throw({
message: The posting date cannot be before JV Posting Date ${formattedDate}
,
title: “Advances Payment”,
wide: true,
indicator: ‘orange’
});
}