Skip to content

Allow Custom Response Configuration for Document Rejection in InsertDocApprovalWorkflowSteps #29654

@Jeremy-Chaing

Description

@Jeremy-Chaing

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    SCMGitHub request for SCM areaextensibility-enhancementNew feature or request related to extensibility

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions