interface "IDocumentProcessor"
{
procedure ProcessDocument();
}
interface "IExtendedDocumentProcessor" extends IDocumentProcessor
{
procedure ValidateDocument();
}
codeunit 50100 SalesInvoiceProcessor implements IExtendedDocumentProcessor
{
procedure ProcessDocument()
var
MessageText: Text;
begin
MessageText := 'Processing Sales Invoice...';
Message(MessageText);
end;
procedure ValidateDocument()
begin
Message('Validating Sales Invoice...');
end;
}
codeunit 50101 SalesOrderProcessor implements IExtendedDocumentProcessor
{
procedure ProcessDocument()
begin
Message('Processing Sales Order...');
end;
procedure ValidateDocument()
begin
Message('Validating Sales Order...');
end;
}
enum 50100 DocumentType implements IExtendedDocumentProcessor
{
Extensible = true;
value(0; SalesInvoice)
{
Caption = 'Sales Invoice';
Implementation = IExtendedDocumentProcessor = SalesInvoiceProcessor;
}
value(1; SalesOrder)
{
Caption = 'Sales Order';
Implementation = IExtendedDocumentProcessor = SalesOrderProcessor;
}
}
page 50100 DocumentProcessingPage
{
PageType = Card;
ApplicationArea = All;
UsageCategory = Administration;
Caption = 'Document Processing';
layout
{
area(Content)
{
group(Group)
{
field(DocumentTypeField; DocumentType)
{
Caption = 'Select Document Type';
}
}
}
}
actions
{
area(Processing)
{
action(ProcessDocument)
{
Caption = 'Process Document';
trigger OnAction()
var
DocumentProcessor: Interface IExtendedDocumentProcessor;
begin
DocumentProcessorFactory(DocumentProcessor);
DocumentProcessor.ProcessDocument(); //I'm getting error at this point, If im commenting this im getting output for ValidateDocument.
DocumentProcessor.ValidateDocument();
end;
}
}
}
local procedure DocumentProcessorFactory(var iDocumentProcessor: Interface IExtendedDocumentProcessor)
begin
iDocumentProcessor := DocumentType;
end;
var
DocumentType: enum DocumentType;
}
ERROR
If requesting support, please provide the following details to help troubleshooting:
Error message:
Function ID -1045640884 was called. The object with ID 0 does not have a member with that ID.
Internal session ID:
ae98ddd9-65ac-44ad-ada7-abe7d3618389
Application Insights session ID:
22fb8d08-be5e-4d91-ae28-c7d982cd7e09
Client activity id:
7c1505a4-7b10-4b22-86f0-f471580eaf57
Time stamp on error:
2024-10-18T04:10:21.2018751Z
User telemetry id:
a47a7ce1-1747-442f-841b-cd2ecfcc0893
AL call stack:
DocumentProcessingPage(Page 50100)."ProcessDocument - OnAction"(Trigger) line 5 - 17Oct by Default Publisher