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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

Call method with [Scope('OnPrem')] in extension with target Cloud

(0) ShareShare
ReportReport
Posted on by 15

I have an extension the i pretend to compile with both targets Cloud/OnPrem.

I've set the scope of some methods with [Scope('OnPrem')] then i'm invoking them in the extensions code.

It all works fine if i set the extension target to OnPrem, but if i set the extension target to Cloud i get the error AL296 - the type or method cannot be used  for 'Cloud' development.

I wanted to manage a single extension. Am i missing something?

What's the best aproach to these situations?

Thanks!

Regards

Bruno M.

I have the same question (0)
  • Suggested answer
    Marco Mels Profile Picture
    on at

    Hello,

    Are you using a Sandbox for the Cloud development?

    Thanks.

  • Bruno_Martins Profile Picture
    15 on at

    Hi,

    no i'm not using a sandbox.

    i'm developing localy.

    I already have a cloud working app. What i need now is to add some onprem functionality to it, so i can deploy it with onprem target.

    I am trying to have one single app by using scopes in the code and different targets in the compilation to deploy onprem or cloud.

    Thanks.

  • Suggested answer
    Tabrez Ajaz Profile Picture
    785 on at

    Hi Bruno,

    It's good to hear that you are trying to achieve something that's really exciting. But I want to give you some suggestions and ideas:

    * For On-Premise and Cloud Sandbox - launch.json file should be different

    * Some functionality is not available for Cloud Sandbox but still working for On-Prem

    * You are also not allowed to use DotNet functionality directly in Cloud Sandbox to achieve this you can use Azure Functions but this is easily achieved in an On-Premise environment.

    So if you are planning to develop an extension that work on both Cloud and On-Prem it's better to do all your development for Cloud Sandbox, it will sure work for On-Prem deployment.

    Note: If you are using an On-Premise environment then make sure to use the latest Business Central version e.g. 2021 wave 1, to get aware of what features are deprecated and what's newly introduced.

  • Bruno_Martins Profile Picture
    15 on at

    Hi Tabrez,

    thanks for your suggestions.

    I'm aware of them. I was trying not to use azure functions.

    thakns again.

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…

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 3,143

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,694 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,067 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans