Loading...

Use XRM type definition in your Javascript file

Use XRM type definition in your Javascript file
Use XRM type definition in your Javascript file Nguyen Van Hao Tue, 01/27/2026 - 13:12
Body

We implement Javascript webresource for form scripting (form onload, field on change,...). Our code need to follow the official document Xrm object, execution context, form context,..

Javascript is not a strong type programing language, we don't have suggession/intellisense like C#, Typescript

In this article, I will show you how to get suggession/intellisense for your JS code

Step 1: Download the file xrm type definition here

Save it to a folder, for example Types\xrm.d.ts

Step 2. Add this line to the top of the JS file that you want to have intellisense

///

 

Step 3: Add type annotation for function param

 

Step 4. Enjoy the magic

You will have suggestions while typing like this

 

It also shows suggestions for Xrm.WebApi

That's all. Hope this help you.

 

Published on:

Learn more
Featured Articles | Dynamics Chronicles
Featured Articles | Dynamics Chronicles

Welcome to our blog, the content is entirely dedicated to Microsoft Dynamics 365, CRM, Power Platform, Common Data Service (CDS) but also Azure. Follow us !

Share post:

Related posts

Stay up to date with latest Microsoft Dynamics 365 and Power Platform news!
* Yes, I agree to the privacy policy