Skip to main content

Notifications

Community site session details

Community site session details

Session Id :

X++ code to view development URL, domain name and build version of D365FO

Chaitanya Golla Profile Picture Chaitanya Golla 17,225

Hi,

In this post we will view the X code to display the development URL, domain name and build version of the D365FO environment.

Created a runnable class CG_ApplicationEnvironemtn(namely) and added the below code. On executing the class, we get the info message provided as Output.

class CG_ApplicationEnvironment
{
    /// 
    /// Runs the class with the specified arguments.
    /// 
    /// The specified arguments.
    public static void main(Args _args)
    {
        var env = Microsoft.Dynamics.ApplicationPlatform.Environment.EnvironmentFactory::GetApplicationEnvironment();

        // Environment URL
        str url = env.Infrastructure.HostUrl;
        info(strFmt("Environment URL: %1", url));

        // Domain Name
        str domainName = env.Infrastructure.FullyQualifiedDomainName;
        info(strFmt("Domain Name: %1", domainName));

        // Build Version
        str buildVersion = env.Infrastructure.BuildVersion;
        info(strFmt("Build Version: %1", buildVersion));

    }

}

Output:

3581.pastedimage1671988076114v1.png

Thanks,

Chaitanya Golla

Comments

*This post is locked for comments