BCApps icon indicating copy to clipboard operation
BCApps copied to clipboard

[Vendor] [On Hold] [Quality Mngmnt] - wokflow activation logic

Open PredragMaricic opened this issue 1 year ago • 4 comments

Describe the issue

Navigate to quality management setup page. Choose Show more in the General tab and activate and then deactivate toggle

Image

explore if events and responses are still there

Image

They are.

Expected: replace toggle with action. Toggle makes sense in the Assisted Setup though. Consider adding it there.

Expected behavior

Steps to reproduce

Additional context

I will provide a fix for a bug

  • [x] I will provide a fix for a bug

PredragMaricic avatar Nov 13 '25 15:11 PredragMaricic

New Information

The Workflow Integration Enabled toggle not only configures settings for built-in workflows but also controls the blocking of events and responses. It still seems logical to separate these aspects: • Creating events and responses should be triggered by an action (for example, a new action called "Insert Workflow Events/Responses" on the Quality Management Setup page). • Keep the toggle to block quality management events, and it should be ON by default (with the initial value set to ON). • In the QM Setup Wizard, add a new toggle during one of the setup steps, allowing users to decide if they want events and responses for Quality Management inserted during the initial configuration stage.

Bug 610811: [Quality Mngmnt] - wokflow activation logic

AndreiPanko avatar Dec 09 '25 11:12 AndreiPanko

New Information

The Workflow Integration Enabled toggle not only configures settings for built-in workflows but also controls the blocking of events and responses. It still seems logical to separate these aspects: • Creating events and responses should be triggered by an action (for example, a new action called "Insert Workflow Events/Responses" on the Quality Management Setup page). • Keep the toggle to block quality management events, and it should be ON by default (with the initial value set to ON). • In the QM Setup Wizard, add a new toggle during one of the setup steps, allowing users to decide if they want events and responses for Quality Management inserted during the initial configuration stage.

Bug 610811: [Quality Mngmnt] - wokflow activation logic

@AndreiPanko This specific part "Creating events and responses should be triggered by an action (for example, a new action called "Insert Workflow Events/Responses" on the Quality Management Setup page)." might break a Business Central pattern. Currently the Business Central workflow system sends events asking extensions for what is available, and the extension responds by adding the events. These events are currently: [EventSubscriber(ObjectType::Codeunit, Codeunit::"Workflow Event Handling", 'OnAddWorkflowEventsToLibrary', '', true, true)] [EventSubscriber(ObjectType::Codeunit, Codeunit::"Workflow Event Handling", 'OnAddWorkflowEventPredecessorsToLibrary', '', true, true)] [EventSubscriber(ObjectType::Codeunit, Codeunit::"Workflow Event Handling", 'OnAddWorkflowTableRelationsToLibrary', '', true, true)] [EventSubscriber(ObjectType::Codeunit, Codeunit::"Workflow Response Handling", 'OnAddWorkflowResponsesToLibrary', '', true, true)] [EventSubscriber(ObjectType::Codeunit, Codeunit::"Workflow Response Handling", 'OnAddWorkflowResponsePredecessorsToLibrary', '', true, true)]

The pattern itself: https://github.com/search?q=repo%3Amicrosoft%2FBusinessCentralApps%20OnAddWorkflowEventsToLibrary&type=code

These are currently fired when the Business Central workflows page list is open.

A recent existing example with the recent e-docs code: https://github.com/microsoft/BCApps/blob/476eb9e792fada798cc49c0762d7f031dc5d5cd8/src/Apps/W1/EDocument/App/src/Workflow/EDocumentWorkFlowSetup.Codeunit.al#L105

By adding an action and an option on the setup page to set these up we'd be breaking that pattern and behaving differently than other Business Central uses of the workflow system.

Before we begin, are we sure we want to do that?

insightworks007 avatar Dec 09 '25 13:12 insightworks007

@insightworks007 Aha! Now i got it.

Enabling toggle is not inserting anything. Settings are inserted when I open page. And that hasn't happen before as toggle was off.

We did round of consultation inside and decided:

We need to remove from both QltyStartWorkflow.Codeunit.al and QltyWorkflowSetup.Codeunit.al if not IsWorkflowIntegrationEnabledAndSufficientPermission() then exit;

together with function IsWorkflowIntegrationEnabledAndSufficientPermission and field in the Quality Management Setup table/page.

Reason: -It took me some time to understand what is happening (or why something is not happening)

We do need a "master switch" to allow user to disable/enable workflows in bulk, but we need it for BaseApp. I'm adding "master switch" suggestion to backlog.

With this - we don't need action in the QM Setup page as insertion happens automatically when user opens page. So we don't need the new toggle in the Wizard as well - for same reason. We need to remove the current toggle and let workflows to work as it currently work in other apps (like e-Documents)

AndreiPanko avatar Dec 09 '25 14:12 AndreiPanko

Resolved with the PR https://github.com/microsoft/BCApps/pull/6361

PredragMaricic avatar Jan 30 '26 08:01 PredragMaricic