XrmDefinitelyTyped icon indicating copy to clipboard operation
XrmDefinitelyTyped copied to clipboard

Are Filter.$in and Filter.NotIn not included in dg.xrmquery.web.promise.min.js

Open obkirneh opened this issue 4 years ago • 6 comments

Hi,

When having a XrmQuery with Filter.$in I get this error:

[object Error]: {description: "Object doesn't support property or method '$in'", message: "Object doesn't support property or method '$in'", number: -2146827850, stack: "TypeError: Object doesn't support property or method '$in' at Anonymous function...

We are using lib dg.xrmquery.web.promise.min.js from XDT v5.3.3

Are Filter.$in and Filter.NotIn not included in minified versions of xrmquery? Looks like it's only implemented in dg.xrmquery.web.js

Regards, Henrik

obkirneh avatar Jun 29 '20 11:06 obkirneh

What version of CRM are you using? Right now those function filters are set to only be available for v9 and above

magesoe avatar Jun 29 '20 11:06 magesoe

The dg.xrmquery.web.js file and it's minified version are generated a new. But it is possible that the version extension logic is applied after the minified version is generated.

TomMalow avatar Jun 29 '20 12:06 TomMalow

We're on Dynamcis 365 v9.1.0000.18945

obkirneh avatar Jun 29 '20 12:06 obkirneh

Well then it can only mean that the minified version is not extended.

Our js file generator does the following in GeneratorMain.fs

printf "Writing to files..."
copyJsLibResourceFiles gSettings
copyTsLibResourceFiles gSettings
generateJSExtResourceFiles crmVersion gSettings
generateDtsResourceFiles crmVersion gSettings out

copyJsLibResourceFiles copies all the version of dg.xrmquery.web.js. That includes the minified and polyfill versions. While generateJSExtResourceFiles and generateDtsResourceFiles extends both the .js and .d.ts versions of the files. That, however, does not include the minified or polyfill versions. These version are generated by a gulp action rather than XDT it self.

As I see it. The solution is to either move the generation of minify and promise version into XDT (hard) or apply the extension the static file so that there is a single version that targets the latest version. Thereby having methods that does not work in older versions.

TomMalow avatar Jun 30 '20 06:06 TomMalow

@TomMalow I think I ran into the same issue. I used the dg.xrmquery.web.min.js file and in my code I wanted to use Filter.equalUserId. But equalUserId does not exist in the minified version even though typescript intellisense suggest that the method does exist. However it does exist in the non-minified version, so I ended up minifing the non-minified by some online minifier tool.

szmarci avatar Jul 13 '20 15:07 szmarci

That sounds definitely like the same problem. The solution you have found works okay, but you will have to do it again each time you upgrade XDT as it will most likely overwrite your minified version.

I am still figuring out how to ensure that all .js versions supports the different versions of CRM so everything is ready to go when using XDT. But not sure when we will have a working solution.

To maintainers: My current idea for a solution is to produce different batches of dg.xrmquery.web.js scripts based of the different possible versions when we build XDT (currently only two batches. pre 9.1 and 9.1 and up). Then service the correct batch when executing XDT. Thereby still producing the minified and promise-fied version at our end.

TomMalow avatar Jul 14 '20 05:07 TomMalow