Extend / Customize standard CanSubmitToWorkflow in D365


We cant override CanSubmitToWorkflow to return our boolean on any eventHandler’s return like eventHandler of ValideWrite(). To achiew we have to set the args of CanSubmitToWorkflow() to be decided by our code.

[PostHandlerFor(formStr(CustTable), formMethodStr(CustTable, canSubmitToWorkflow))]

    public static void CustTable_Post_canSubmitToWorkflow(XppPrePostArgs args)


        FormRun     form = args.getThis();

        FormDataSource      custTable_ds = form.dataSource(formDataSourceStr(custTable,CustTable)) as FormDataSource;

        custTable           custTable    = custTable_ds.cursor();

        if (custTable.RecId && custTable.DocumentStatus == DocumentStatus::NotSubmitted)