Could someone please help me with the issue in this code? When I try to run it in my vscode, I get an error that says 'Xrm not defined'. Here is the code snippet:
async function GetEnvironmentVariableValue(name: string): Promise<string | null> {
let results = await Xrm.WebApi.retrieveMultipleRecords("environmentvariabledefinition", `?$filter=schemaname eq '${name}'&$select=environmentvariabledefinitionid&$expand=environmentvariabledefinition_environmentvariablevalue($select=value)`);
if (!results || !results.entities || results.entities.length < 1) return null;
let variable = results.entities[0];
if (!variable.environmentvariabledefinition_environmentvariablevalue || variable.environmentvariabledefinition_environmentvariablevalue.length < 1) return null;
return variable.environmentvariabledefinition_environmentvariablevalue[0].value;
}
I'm trying to retrieve environment variables from Microsoft Dynamics 365 PowerApps.