Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crmVersion should also set defaultVersion of the API URL #245

Open
skfd opened this issue Oct 26, 2021 · 4 comments
Open

crmVersion should also set defaultVersion of the API URL #245

skfd opened this issue Oct 26, 2021 · 4 comments

Comments

@skfd
Copy link

skfd commented Oct 26, 2021

Right now XrmDefinitelyTyped requires us, as 9.1 users, to call setVersion in each form script. But theoretically we already provided our preferred version when generating the definitions with -cv 9.1 argument.

I think the defaultVersion of the API should be generated and not hardcoded, does this sound like a good idea?

Thank you!

@magesoe
Copy link
Collaborator

magesoe commented Oct 27, 2021

This issue has been raised before. Imo. it should just be updated with each minor update of the API such that XDT by default uses the newest API. Of course this is up to the current maintainers :)

@skfd
Copy link
Author

skfd commented Oct 27, 2021

This strategy does not take into account that there are on-premise users. We do not upgrade immediately. And 9.2 is still unavailable to us even if we wanted to upgrade to it.

@misoeli
Copy link
Member

misoeli commented Oct 28, 2021

We should be updating the API version already, which I can see is an issue for onprem.
Adding a flag to allow overriding the version on generation could be a viable solution - we'll take a look into it.

@Aagaard00
Copy link

Aagaard00 commented Dec 22, 2023

I looked into this issue while working on an onprem project. 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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants