Monday, September 25, 2023

Get D365Fo Host name

using Microsoft.Dynamics.ApplicationPlatform.Environment;
public str GetInfrastructureHost()
{
        IApplicationEnvironment env = EnvironmentFactory::GetApplicationEnvironment();
        str hostUrl = env.Infrastructure.HostUrl;
        
        // Trim https://
        hostUrl = subStr(hostUrl, 9, strLen(hostUrl) - 8);

        return subStr(hostUrl, 1, strFind(hostUrl, '.', 1, strLen(hostUrl)) - 1);
}

No comments:

Post a Comment

Table browser URL in D365FO

Critical Thinking icon icon by Icons8