microsoft / microsoft/ALAppExtensions

Allow Custom Response Configuration for Document Rejection in InsertDocApprovalWorkflowSteps

Open
#29,654 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

ext-ready-to-implement extensibility-enhancement SCM
Dominant language
AL
Stars
988
Forks
692
Avg merge
49m
Merged PRs (30d)
1

Description

Why do you need this change?

Currently, the InsertDocApprovalWorkflowSteps function in Codeunit 1502 "Workflow Setup" automatically inserts a hard-coded "Reopen Document" response when an approval request is rejected (line 1457-1462). While this behavior works for standard BC documents, it creates limitations for custom approval workflows where different business logic is required upon rejection.

Benefits of this change:

  1. Enable Custom Status Handling on Rejection: Extensions could configure workflow templates to set documents to custom statuses (e.g., "Rejected", "Declined", "Canceled") when approval is rejected, rather than always reverting to "Open" status. This provides better audit trails and clearer document lifecycle management.

  2. Improved User Experience: End users would no longer need to manually modify the workflow create from workflow templates to replace the default "Reopen Document" response with custom responses. The desired rejection behavior could be built into the workflow template from the start, making the solution more user-friendly and reducing configuration complexity.

Describe the request

Current Behavior:
In Codeunit 1502 "Workflow Setup", the InsertDocApprovalWorkflowSteps procedure contains the following hard-coded logic at approximately line 1462:

InsertResponseStep(Workflow, WorkflowResponseHandling.OpenDocumentCode(), RejectAllApprovalsResponseID)

This automatically inserts "Reopen Document" as a response to all rejection events, with no option to override or customize this behavior.

Requested Change:
Add an optional parameter or configuration mechanism to InsertDocApprovalWorkflowSteps that allows developers to specify custom response codes for the rejection scenario.

Internal work item: AB#620283

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Codeunit 1502 "Workflow Setup" and the InsertDocApprovalWorkflowSteps procedure around lines 1457-1462, especially the hard-coded InsertResponseStep call. Trace how rejection response codes are passed into workflow templates, then confirm that custom rejection behavior can be configured without forcing "Reopen Document" while preserving the standard default.

Written by the indexing model from the issue text.

Assessment

Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.