D365 How to toggle a checkbox in a batch job dynamically

[ExtensionOf(classStr(AMCaseJournalPost_CaseClosing))]
public final class AMCaseJournalPost_CaseClosing_DEV_Extension
{
    public boolean modifiedDialogPosting_DEV(FormCheckBoxControl _control)
    {
        FormCheckBoxControl ctrlDialogPostCostFromWIP;

        ctrlDialogPostCostFromWIP = dialogPostCostFromWIP.control();
       
        ctrlDialogPostCostFromWIP.checked(_control.checked());

        return true;

    }

    public Object dialog()
    {
        DialogRunBase   dialog;
        FormBuildCheckBoxControl ctrlDialogPosting;

        dialog = next dialog();

        //redirecting modified action to our new method
        ctrlDialogPosting = dialogPosting.control();
        ctrlDialogPosting.registerOverrideMethod(methodStr(FormCheckBoxControl, modified), methodStr(AMCaseJournalPost_CaseClosing, modifiedDialogPosting_DEV), this);

        return dialog;
    }

}