Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

167
Vistas
Dynamics 365 unable to reference javascript functions from exported typescript classes

I'm encountering an issue attempting to reference javascript functions from Dynamics 365 forms when the javascript files have been compiled from typescript that is exporting the class the function resides in (which I'm doing in order to run unit tests against them). The same problem does not occur if i put the function in a namespace instead, but it does if i then try to export the namespace instead/aswell as the function (again to be able to be reference in unit tests.

In each of the cases below, inside Dynamics in the onchange event I am referencing the function to be called by Referral.OpenDialogOnHold.

So when using:

export class Referral {
 static OpenDialogOnHold(context: Xrm.Events.EventContext) {
    try {
      Xrm.Navigation.navigateTo(
      ...
    );
    } catch (exception) {
      console.error(exception);
    }
  }
}

or

export namespace Referral {
 export function OpenDialogOnHold(context: Xrm.Events.EventContext) {
    try {
      Xrm.Navigation.navigateTo(
      ...
    );
    } catch (exception) {
      console.error(exception);
    }
  }
}

then it fails inside Dynamics saying it cannot find the function names Referral.OpenDialgOnHold

but if I use:

namespace Referral {
 export function OpenDialogOnHold(context: Xrm.Events.EventContext) {
    try {
      Xrm.Navigation.navigateTo(
      ...
    );
    } catch (exception) {
      console.error(exception);
    }
  }
}

then it works fine, however I'm then struggling to reference the function within unit tests as it complains the file is not a module.

Any assistance gratefully appreciated!

ts.config settings are:

{
  "compileOnSave": true,
  "compilerOptions": {
    "target": "ES5",
    "module": "ES2015",
    "rootDir": "ts",
    "moduleResolution": "node",
    "sourceMap": true,
    "outDir": "Webresources/ih_/js",
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "strict": true,
    "skipLibCheck": true
  },
  "exclude": ["tests/**/*"]
}
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda