web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Troubleshooting Document Processing in D365: Error with Interface Implementation

(1) ShareShare
ReportReport
Posted on by 244

Hi Everyone,

I am currently implementing a new feature in Business Central using interfaces, but I have encountered a problem. I would appreciate any insights or assistance regarding this issue. Thank you!

 
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

 
I have the same question (0)
  • Gerardo Rentería García Profile Picture
    25,390 Most Valuable Professional on at
    Hi
    Can you try completely uninstalling and reinstalling?
    Best
    GR
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    20,977 Super User 2025 Season 2 on at
    The error message you're seeing indicates that the system is trying to call a function with an ID that doesn't exist in the current context. This usually happens when there are issues with how the interfaces and implementations are referenced or instantiated.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,594

#2
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 745 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 530

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans