Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Unanswered

How to handle"xxxx" is internal and can be called only from within the same module or assembly

(1) ShareShare
ReportReport
Posted on by 312
Hi guys,
 
When trying to use this method :
         SubBillDeferralScheduleCreate::createScheduleFromCustInvoice(custInvoiceTrans.SalesId, 0, custInvoiceTrans.InvoiceId, true);
 
I'm hit this error :  Method 'createScheduleFromCustInvoice' is internal and can be called only from within the same module or assembly. 
 
May I know what is best if I still need to call or run the procedure inside ? Is by copying the method into my custom class would be fine ? or is there any other workaround ?
 
This method actually coming from Extension Class built by Microsoft self, related to Subscription Billing feature ->
internal final class SalesInvoiceJournalPostSubBill_Extension
There is one method inside the mentioned class which I would like to run as well in my custom class, specifically from this method :
private void createDeferralSchedule()    {        if (SubBillDeferralEnableFeature::isEnabled())        {            CustInvoiceJour custInvoiceJour;            ProjProposalJour projProposalJour;            SalesParmTable salesParmTable;                    if (!this)            {                return;            }            if (SubBillProjectEnableFeature::isEnabled() && (this is SalesInvoiceJournalPostProj))            {                projProposalJour = this.parmProjProposalJour();                parmJournalTableBuffer = this.parmJournalTable();                if (parmJournalTableBuffer is SalesParmTable)                {                    salesParmTable = parmJournalTableBuffer;                }                                SubBillDeferralScheduleCreate::createScheduleFromProjInvoice(salesParmTable.SalesId, 0, projProposalJour, true);            }            else            {                parmJournalTableBuffer = this.parmJournalTable();                if (parmJournalTableBuffer is CustInvoiceJour)                {                    custInvoiceJour = parmJournalTableBuffer;                }                                if (!custInvoiceJour.InvoiceId)                {                    // pro forma, no processing should be done                    return;                }                if (custInvoiceJour.SalesId != '')                {                    SubBillDeferralScheduleCreate::createScheduleFromCustInvoice(custInvoiceJour.SalesId, 0, custInvoiceJour.InvoiceId, true);                    //Create schedule for charges                    SubBillDeferralScheduleCreate::createSalesLineChargesSchedule(custInvoiceJour.SalesId, 0, custInvoiceJour.InvoiceId);                }            }        }    }
I would want my class to execute the one in last section of Else condition.
 
May I have some advice.
Thanks
 
 
  
  • Layan Jwei Profile Picture
    Layan Jwei 7,632 Super User 2025 Season 1 on at
    How to handle"xxxx" is internal and can be called only from within the same module or assembly
    Hi Teevo,
     
    As the errors says, you can't call internal methods from a different model.
     
    It's either u duplicate the method, which means if sth is changed from Microsoft side inside this method, then u need to amend ur duplicated method to match it. Or you raise a ticket with Microsoft
     
     
    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future
  • Martin Dráb Profile Picture
    Martin Dráb 230,846 Most Valuable Professional on at
    How to handle"xxxx" is internal and can be called only from within the same module or assembly
    Your design is impossible to implement. Even if you could extend the method, you couldn't change its code, such as adding something to the else block. You'll need to rethink your solution.
     
    You also can't use internal members of other modules. Duplicating the method is an option if you want to call the same logic on your own and you don't have to change behavior of the method called by the system. It's still far from ideal, because you then must keep maintaining your copy when Microsoft change their code. If you want to change what happens when SalesInvoiceJournalPostSubBill_Extension calls createScheduleFromCustInvoice(), creating your own method won't help you at all, because your method won't be called there.
     
    I would start by analyzing the requirement and try to find a way how to achieve it without code that isn't accessible. If not, the next step should be asking Microsoft to make the code extensible.

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

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,971 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,846 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans