Handle failure to manually create E-Document from posted doc with no …#8183
Handle failure to manually create E-Document from posted doc with no …#8183georgepomazkov wants to merge 4 commits into
Conversation
|
@microsoft-github-policy-service agree |
Groenbech96
left a comment
There was a problem hiding this comment.
Minor, otherwise great change.
| RunEDocumentCheck(PostedRecord, Enum::"E-Document Processing Phase"::Post); | ||
|
|
||
| NoOfExistingEDocuments := this.GetEDocumentCountForDocument(RecordRef); | ||
| EDocumentSubscribers.CreateEDocumentFromPostedDocument(PostedRecord, DocumentSendingProfile, DocumentType); |
There was a problem hiding this comment.
Would be possible to return a bool from the CreateEDocumentFromPostedDocument.
Then exit(EDocumentSubscribers.CreateEDocumentFromPostedDocument(PostedRecord, DocumentSendingProfile, DocumentType)).
Less load, since we have the information inside the function call.
|
@copilot Please pull main into this branch. |
|
@copilot Fix the merge conflict |
|
@copilot Fix the merge conflict |
Resolve conflicts in EDocExport.Codeunit.al and EDocumentSubscribers.Codeunit.al by combining the AllowReExport overloads from main with the Boolean return value from the PR. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
|
||
| if not EDocWorkFlowProcessing.GetServicesFromEntryPointResponseInWorkflow(WorkFlow, EDocumentService) then | ||
| exit; | ||
| exit(false); |
There was a problem hiding this comment.
Workflow misconfiguration shown as creation failure
When GetServicesFromEntryPointResponseInWorkflow returns false (no E-Document services on the workflow entry point), the call chain returns false and every page extension shows 'The e-document could not be created.' This is a setup/configuration issue, not a creation failure, so the message is misleading and unhelpful to the user.
Recommendation:
- Return a more specific error or raise an informative
Error()call when no services are found in the workflow, e.g. 'No E-Document services are configured for the active workflow. Please check E-Document workflow setup.'
| exit(false); | |
| if not EDocWorkFlowProcessing.GetServicesFromEntryPointResponseInWorkflow(WorkFlow, EDocumentService) then begin | |
| // Optionally log or raise a specific error so the user can diagnose the configuration issue | |
| exit(false); | |
| end; |
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
False return when E-Doc already exists misleads userWhen an E-Document already exists for the record and Recommendation:
Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why |
New label missing Comment attribute for translationThe Recommendation:
Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why |
New label missing Comment attribute for translationSame as the analogous label in EDocIssuedFinChargeMemo: Recommendation:
Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why |
Unsupported document type shows vague creation errorWhen Recommendation:
Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why |
| Error(ElectronicDocumentErr, DocumentSendingProfile.Code); | ||
|
|
||
| RunEDocumentCheck(PostedRecord, Enum::"E-Document Processing Phase"::Post); | ||
| EDocumentSubscribers.CreateEDocumentFromPostedDocument(PostedRecord, DocumentSendingProfile, DocumentType); |
There was a problem hiding this comment.
Bare exit in Boolean procedure triggers error message
exit; (without a value) in an AL Boolean-returning procedure implicitly returns false. If PostedRecord.IsRecord() is false, the procedure returns false and all page extensions show 'The e-document could not be created.' This edge case previously exited silently; now it misleads the user.
Recommendation:
- Return early with no message when the record variant is invalid, or validate the variant before calling this procedure.
| EDocumentSubscribers.CreateEDocumentFromPostedDocument(PostedRecord, DocumentSendingProfile, DocumentType); | |
| if not PostedRecord.IsRecord() then | |
| exit(false); // Document not applicable; caller should guard before invoking |
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
Fixes message 'The e-document has been created.' being shown to user when the e-document was not in fact created.
What & why
In cases when the e-document could not be manually created from a posted document page with no explicit error, the system would still tell the user that 'The e-document has been created.'.
The fix implements propagating the result of creating E-Document back to the calling procedure
CreateEDocumentFromPostedDocumentPage()which returns true if the e-document was created and false otherwise, in which case message 'The e-document could not be created.' is shown to user.Linked work
Fixes #8181
How I validated this
What I tested and the outcome (required ΓÇö be specific: scenarios, commands, screenshots for UI changes)
Manually tested the case for posted sales invoice described in the issue, the system showed the following message when the e-document was not created due to the document type not being supported by the E-Document Service and no explicit error being thrown.
Risk & compatibility
None.
Fixes AB#636180