XrmDefinitelyTyped icon indicating copy to clipboard operation
XrmDefinitelyTyped copied to clipboard

XrmQuery default API version based on CRM Version

Open Aagaard00 opened this issue 1 year ago • 0 comments

Related to issue #245

Changed XrmQuery default API version to be based on CRM Version of the model driven app instead of being hardcoded to 9.2 in the TS "sourcefile" for the XrmQuery JS files

The possible solution i came up with was to replace

const DefaultApiVersion = "9.2";

with

const DefaultApiVersion = Xrm.Utility.getGlobalContext().getVersion().split('.').slice(0, 2).join('.');

In \src\XrmDefinitelyTyped\Resources\dg.xrmquery.web.ts which the xrmQuery files are generated from. In this way the default api version used is decided by the CRM version of the model driven app where the code is run.

Are there any issues with this solution?

Aagaard00 avatar Jan 11 '24 14:01 Aagaard00