[E-doc] [Clearance model] Fix bug that clearance model generate replicated log#7391
[E-doc] [Clearance model] Fix bug that clearance model generate replicated log#7391
Conversation
There was a problem hiding this comment.
AL Documentation Audit
Documentation gaps were detected in the following apps:
- E-Document-Core-Tests: 0% documentation coverage
- E-Document-Core: 3% documentation coverage
To generate documentation, run /al-docs init or /al-docs update using GitHub Copilot CLI or Claude Code.
This review is for awareness to help keep documentation in sync with code changes. It is okay to dismiss this request.
…atedTwice' of https://github.com/microsoft/BCApps into private/wenjiefan/bug-605044-E-doc-WorkflowReponseGeneratedTwice
| EDocumentService.Get(WorkflowStepArgument."E-Document Service"); | ||
|
|
||
| // If the E-Document has already been exported, skip re-exporting it. | ||
| if EDocServiceStatus.Get(EDocument."Entry No", EDocumentService.Code) then |
There was a problem hiding this comment.
What if you want to reexport?
Is that possible.
Try post document: Then it gets exported, then you change some editable field on posted document, and want that change to reflect in the e-document. What do you do in this case?
There was a problem hiding this comment.
Our fix is in EDocumentWorkFlowProcessing.ExportEDocument() — the workflow response handler. It only runs when the workflow engine automatically fires the Export response step. The skip logic prevents a duplicate within the same workflow execution, because CreateEDocument already pre-exports the document before the workflow fires its Export response.
Manual re-export ("Recreate Document" action on the E-Document page) calls EDocExport.Recreate() → EDocExport.ExportEDocument() directly. This path never goes through the workflow processing layer, so the status check we added is never hit.
Manual Re-export (unaffected):
Page Action "Recreate" -> EDocExport.Recreate() -> EDocExport.ExportEDocument() -> always executes
Workflow auto-trigger (what we fixed):
Workflow Engine -> EDocumentWorkFlowProcessing.ExportEDocument() -> [status check -> skip if already Exported]
There was a problem hiding this comment.
(Correct me if I misunderstand this function)
Summary
Work Item(s)
Fixes AB#605044