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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

only be visible or enabled when the environment is Production

(8) ShareShare
ReportReport
Posted on by 188
Dear all
I want to create an action on a page that should only be visible or enabled when the environment is Production, and hidden/disabled in Sandbox or Development. What is the recommended approach in AL to conditionally control actions based on the current environment?
 
thank you
I have the same question (0)
  • Verified answer
    Sahan Hasitha Profile Picture
    2,683 on at
    hi
     
    you can use the Environment Information page provides key details about the current tenant and environment. It shows whether you are working in Production or Sandbox, the environment name, region, and version details. This information is useful for administrators and developers to quickly verify where they are working, especially when multiple environments exist, and helps ensure that changes or tests are performed in the correct place
  • Verified answer
    Sahan Hasitha Profile Picture
    2,683 on at
    hi 
    thy this
  • Suggested answer
    Rishabh Kanaskar Profile Picture
    6,219 Super User 2026 Season 1 on at
    Hi,
     
    Use Session.CurrentEnvironment() in AL.
    Example:
     
    actions
    {
        addlast(processing)
        {
            action(MyProdOnlyAction)
            {
                ApplicationArea = All;
                Caption = 'Prod Action';
                Visible = Session.CurrentEnvironment() = 'Production';
            }
        }
    }

    This ensures the action is only visible when the environment is Production.
     
    Thanks
    Rishabh
  • Suggested answer
    Nimsara Jayathilaka. Profile Picture
    4,950 Super User 2026 Season 1 on at
    Hi
     
    You can use "Environment Informations" Codeunit.
    There are different procedures Check whether if it is Production , OnPrem , SaaS...etc
  • Sumit Singh Profile Picture
    11,757 Super User 2026 Season 1 on at
    Hi Everyone,
     
    I think this query is already resolved and also having verified answer, so no need to revert on this. Thanks!
  • Suggested answer
    YUN ZHU Profile Picture
    99,055 Super User 2026 Season 1 on at
    Just add some info:
    Dynamics 365 Business Central: How to quickly get the current environment name, environment type, and deployment type via AL
     
    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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,926 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,158 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 533 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans