-
Notifications
You must be signed in to change notification settings - Fork 1
Project Setup
The DynamicsPortalScripts Visual Studio solution contains shared TypeScript libraries for shared Dynamics Portal scripts includes two primary folders:
- scripts - contains the current set of shared library scripts as TypeScript files
- typings - includes any typescript reference/definition files required for the TypeScript compiler Once compiled, the scripts can be included in your Dynamics Portal project.
References to external TypeScript definitions have been included in the typings folder. These are required to allow references strong types in Types. For example, a snippet referencing a JQuery object:
var name: JQuery = $("#futz_name").val();
For this to compile in TypeScript, the following reference is required:
/// <reference path="../typings/jquery/jquery.d.ts"/>
The project is currently set up to reference the latest version of TypeScript installed with Visual Studio. This and other TypeScript setting can be viewed by looking at the Visual Studio project settings and the TypeScript Build tab.
Editing the TypeScript file or choosing Build will generate the JavaScript to be published to the portal. Each JS file should be named the same as the corresponding TS file and is included in the Portal
The folder breakdown for your project is flexible. One model is to build a folder structure based on the Dynamics Portal entity to which the Script will be attached. For example, you may include a folder named WebTemplates and include all WebTemplates in your Dynamics Portals project
For this iteration, the Visual Studio solution and project include the single folder scripts but follows a simple naming convention for clarity. Each TypeScript file is named with the prefix according to its content and a suffix corresponding to the type of Portal record to which it will be deployed. For example:
Script - Common Utilities - Web Template.ts
This TypeScript content is Script and it will be deployed as a Web Template.
This can be rearranged to suit your project needs.