If you want to get the details about the environment you don’t have to reinvent the wheel, you can simply use the standard codeunit Microsoft has introduced. If you look into the codeunit 457 “Environment Information”, you will see there are many procedures that fetch attributes concerning the environment of the service on which the tenant is hosted. Codeunit 457 is part of the System Application.Source.
Below are some of the procedures available in the codeunit 457
Below function will return true if the environment type is Production.
procedure DisplayEnvironmentType() var EnvironmentInformation: Codeunit "Environment Information"; begin if EnvironmentInformation.IsProduction() then Message('Production Environment') else Message('Not a Production Environment'); end;
Below function will return the environment name
procedure DisplayEnvironmentName() var EnvironmentInformation: Codeunit "Environment Information"; begin Message('%1', EnvironmentInformation.GetEnvironmentName()); end;
Below are the rest of the functions and all of them are pretty self-explanatory.
Thank you and Regards,
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?