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
Need help with this product?

We can help you with Use XRM type definition in your Javascript file

If you want help implementing, troubleshooting, or improving this product, contact us and we’ll point you in the right direction.

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

Newsletter

Get the latest Dynamics 365 and Power Platform content in your inbox

A curated digest of community blogs, product news, videos, and podcasts — delivered without the noise.

Weekly updates Unsubscribe anytime Fresh community picks
We use your email only for the newsletter and you can unsubscribe at any time.
By subscribing, you agree to the privacy policy.