Skip to main content

Notifications

Announcements

No record found.

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 54

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

  • Suggested answer
    Divan Profile Picture
    Divan 54 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.

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,081 Super User 2024 Season 1 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.

  • Verified answer
    YUN ZHU Profile Picture
    YUN ZHU 75,848 Super User 2024 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

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,735 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,466 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans