I have set up a folder structure for creating some event handlers in TypeScript.
I have installed node types
npm install @types/node --save-dev
and xrm types
npm install @types/xrm --save-dev
In my form.ts . my event handler code works but in the intellisense, I appear to be short changed 😒 , as I am missing some key methods such as setNotification on my dob control ... Anybody seen this before
I can confirm I can define the date control in a couple of ways and still ensure I am able to send notifications.
var dobFieldControl1 = formContext.getControl<Xrm.Controls.DateControl>(dobFieldLogicalName);
dobFieldControl1.setNotification( "First syntax","whatever");
const dobFieldControl2 : Xrm.Controls.DateControl = formContext.getControl(dobFieldLogicalName);
dobFieldControl2.setNotification( "Second syntax","whatever");
I believe that was done because some of the controls do not have notification capabilities like iframes and subgrids.
And you can click "Accept as Solution" to close the thread.
Hi thanks,
I will report this to them. Does seem very confusing given the form control works fine with out needing to cast to a XRM type .
Yes this does work, with no type issues. So are we casting to the correct type with this syntax?
var dobFieldControl1 = formContext.getControl<Xrm.Controls.DateControl>(dobFieldLogicalName);
dobFieldControl1.setNotification( "eee","whatever");
Hello, try to use the following syntax:
const dobFieldControl = formContext.getControl<Xrm.Controls.DateControl>("fieldname");
dobFieldControl.setNotification("whatever");
the package types/xrm is not created by Microsoft but from the community, the GitHub project should be this one https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/xrm
mmbr1606
22
Super User 2025 Season 1
stampcoin
17
ankit_singhal
11
Super User 2025 Season 1