Stop Processing Statuses When a checkbox is not check in the app

Hello,

I'm trying to stop a status from moving forward if any of the 3 check boxes are not checked and have an error message pop up explaining the error. Right now my code will not allow me to move to the first process, if I remove the code the app will work again. I just would like it to stop on the SUPLY CHAIN REVIEW status and throw an error message to the user. Here is the code I have written. I reviewed some of the topics in the forum to help write the code.

(function () {
"use strict";

var COMPLETE1 = 'scn_chk_1'; //check box field name
var COMPLETE2 = 'scn_chk_2'; //check box field name
var COMPLETE3 = 'scn_chk_3'; //check box field name


var events = ['app.record.detail.process.proceed'];

kintone.events.on(events,  async (eventLeave) => {
    var record = eventLeave.record;
    var CURSTATUS = record.Status.value;
    //var NEWSTATUS = record.nextStatus.value;
    var chkboxVal1 = record[COMPLETE1].value;
    var chkboxVal2 = record[COMPLETE2].value;
    var chkboxVal3 = record[COMPLETE3].value;
    var error_message1 = "Please Complete the REVIEW AND COMMUNICATION TO PACKAGING TEAM LEADS";
    var error_message2 = "Please Complete the REVIEW AND COMMUNICATION TO PC TEAM LEADS";
    var error_message3 = "Please Complete the REVIEW AND COMMUNICATION TO QC TEAM LEADS";
    var error_loc1 = "PLEASE CHECK HERE";

    if (CURSTATUS === 'SUPPLY CHAIN REVIEW' &&  chkboxVal1.checked == false) {
            eventLeave.error = error_message1;
            record[COMPLETE1].error = error_loc1;
    }
    if (CURSTATUS === 'SUPPLY CHAIN REVIEW' && chkboxVal2.checked == false) {
        eventLeave.error = error_message2;
        record[COMPLETE2].error = error_loc1;
}
    if (CURSTATUS === 'SUPPLY CHAIN REVIEW' && chkboxVal3.checked == false) {
         eventLeave.error = error_message3;
         record[COMPLETE3].error = error_loc1;

}
return eventLeave;

});

})();

This is the section with the checkboxes

image

Let me add - If the user tries to advance to the next status I would like it to stop the advancement and through the error. The next status would be QAS COMPLIANCE. Any advice or guidance would be grateful. Thank you.

Hello @dpoetsch,

It sounds like the native plugin called Process Management Required Fields would do the trick. This plugin allows you to set certain fields as required to proceed with the Process Management feature.

Thanks @Chris. Sorry for the late response. I've been busy on other projects.