Skip to content

EnvironmentVariable

Niels Steenbeek edited this page Jul 16, 2021 · 2 revisions

CLI Command generate EnvironmentVariable

Command

hso-d365 generate EnvironmentVariable

Description

CLI Command 'generate EnvironmentVariable' generates a folder EnvironmentVariable.

Generated files

Following files will be generated:

  1. src/EnvironmentVariable/EnvironmentVariable.service.ts
  2. src/EnvironmentVariable/EnvironmentVariable.model.ts

EnvironmentVariable.service.ts

This is a service class similar as generated for Entities. It contains the Solution Environment Variables getters.

Example

export class EnvironmentVariableService {
    // Method generated for you
    public static async getYourEnvVar(): Promise<string> {
        // logic generated for you
    }

    //
}

Example in form

static async onLoad(executionContext: Xrm.Events.EventContext): Promise<void> {
    const myVar = await EnvironmentVariableService.getYourEnvVar();
}

EnvironmentVariable.model.ts

This is a model class similar as generated for Entities. You don't have to look into this one.

Help

Use command

hso-d365 generate EnvironmentVariable --help