just want to ask what is the problem in the code when i pass this to my vscode, it says an error of: ‘Xrm not defined’ here is the code:
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 just want to get the value of environment variables from dynamics 365 powerapps.