After writing a lot of TypeScript form logic held in multiple files, I thought I would include all my common functions in a helper.ts file. Getting it wired up is proving a bit difficult. Be interested in hearing any advice.
I have set up simple project structure for an app. To start with I have 2 files
-
utilshelper.ts
// show a simple dialog export function displayPromptText(titleText : string, promptText : string) { let alertStrings = { confirmButtonLabel: "Ok", text:promptText, title: titleText }; var confirmOptions = { height: 400, width: 450 }; Xrm.Navigation.openAlertDialog(alertStrings, confirmOptions).then( function (success) { console.log("Dialog closed using OK button."); }, function (error) { console.log(error.message) } ) }
-
FormsMyForm.ts
import * as helper from "../utils/helper" // also tried this // import { displayPromptText } from "../utils/helper"; // if you call the line below say in Form load you get the intialisation error helper.displayPromptText("test","test");