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

Community site session details

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

The application object or method 'GetPaymentInstructionsFromPostedInvoice' has scope 'OnPrem' and cannot be used for 'Cloud' development.

(0) ShareShare
ReportReport
Posted on by 99

Hi,

Can you please assist? I am trying add a field to an existing report but when I copy the code from the original report to add the extra field I get an AL0296: The application object or method 'GetPaymentInstructionsFromPostedInvoice' has scope 'OnPrem' and cannot be used for 'Cloud' development error. This specific field comes from the old report.

I have tried to change the app.jason target to "OnPrem" and it works when building the report but fails when uploading to the cloud with error: Package validation failed due to the following error(s): app.json (8,3) - Error PTE0005: The compilation target is set to 'OnPrem', but it must be set to 'Cloud' or 'Extension'

app.json :

  "target": "Cloud",

I have also tried the reportextension method but I cant seem to link to the correct table when trying to only add this and not redo the whole report.

This is the existing code that fails:

               Clear(PaymentInstructionsTxt);
                PaymentInstructionsTxt := O365SalesInvoiceMgmt.GetPaymentInstructionsFromPostedInvoice(Header);

And the report extension code:

reportextension 50201 "IPL_SalesInvoice" extends "Standard Sales - Invoice"
{
    RDLCLayout = 'src\Business Central\src\reportLayout\IPL Sales Invoice.rdlc';
    dataset
    {
        add(IPL_SalesOrder)
         {
            column(Sales_Assistant; "Sales Assistant") { }
        }
    }
}

Also below my table extension for IPL_SalesOrder to add the sales assistant field:

tableextension 60001 IPL_SalesOrder extends "Sales Header"
{
    fields
    {
        field(50000; IPL_SalesAssistant; Text[30])
        {
            Caption = 'Sales Assistant';
        }
    }

}

Please advice as I am now stuck

Thanks

I have the same question (0)
  • Verified answer
    YUN ZHU Profile Picture
    94,111 Super User 2025 Season 2 on at
    RE: The application object or method 'GetPaymentInstructionsFromPostedInvoice' has scope 'OnPrem' and cannot be used for 'Cloud' development.

    Hi, Yes, Microsoft has a lot of standard code that cannot be copied directly.
    If you're just adding fields, here's a very simple example that hopefully gives you some hints.

    https://yzhums.com/10723/

    Thanks

    ZHU

  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at
    RE: The application object or method 'GetPaymentInstructionsFromPostedInvoice' has scope 'OnPrem' and cannot be used for 'Cloud' development.

    Yes, in that case the copied code will not work if that are set OnPrem and you are trying to publish the same on Cloud. You need to take the same object from Cloud and make the changes in there and publish.

  • Suggested answer
    Divan Profile Picture
    99 on at
    RE: The application object or method 'GetPaymentInstructionsFromPostedInvoice' has scope 'OnPrem' and cannot be used for 'Cloud' development.

    Thanks, this works very well and a lot less coding needed.

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

Responsible AI policies

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

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,351

#2
Sumit Singh Profile Picture

Sumit Singh 2,072

#3
YUN ZHU Profile Picture

YUN ZHU 1,807 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans