XrmDefinitelyTyped icon indicating copy to clipboard operation
XrmDefinitelyTyped copied to clipboard

Uncaught (in promise) Error: XrmQuery: Unable to properly parse function: x => x.accounts

Open pagex opened this issue 5 years ago • 8 comments

your own example does not work: XrmQuery.retrieveMultiple(x => x.accounts) // Tells XrmQuery to retrieve accounts .select(x => [x.accountnumber]) // Select which attributes to retrieve, in this case just accountnumber .filter(x => Filter.equals(x.name, "Contoso")) // Only get accounts which have a name equal to "Contoso" .execute(accounts => { // Do something with the retrieved accounts console.dir(accounts); }); dg.xrmquery.web.min.js?ver=1623372669:1 Uncaught (in promise) Error: XrmQuery: Unable to properly parse function: x => x.accounts at d (dg.xrmquery.web.min.js?ver=1623372669:1) at f (dg.xrmquery.web.min.js?ver=1623372669:1) at c (dg.xrmquery.web.min.js?ver=1623372669:1) at Function.e.Get (dg.xrmquery.web.min.js?ver=1623372669:1) at Object.t.retrieveMultiple (dg.xrmquery.web.min.js?ver=1623372669:1) at getRoleName (icams_common.js?ver=1623372669:54) at icams_common.js?ver=1623372669:92 at Generator.next () at icams_common.js?ver=1623372669:8 at new Promise ()

it tries to match x=>x.accounts to /function[^(](([a-zA-Z0-9_]+)[^{]{([\s\S]*)}$/m in function d(t) { var e = t.toString().match(H); if (!e) throw new Error("XrmQuery: Unable to properly parse function: " + t.toString()); return { arg: e[1], body: e[2] } }

pagex avatar Nov 19 '19 05:11 pagex

Most likely a duplicate of #36.

mktange avatar Nov 19 '19 08:11 mktange

yes, it is duplicate of #36 as it expects ES5 function keyword instead of ES6 arrow.

pagex avatar Nov 20 '19 03:11 pagex

Is support for ES6 planned in the future? I would like to use async/await feature and transpile to ES6 instead of ES5.

sowka1995 avatar Dec 23 '19 13:12 sowka1995

Our time is limited, so I can not say when XDT supports ES6, but we would love a PR that adds support for it

magesoe avatar Dec 23 '19 13:12 magesoe

Our time is limited, so I can not say when XDT supports ES6, but we would love a PR that adds support for it

I'll like to take a stab at it, I have the stack trace based on the error. Do you have any gotchas before I get started?

ferodom avatar Feb 13 '20 16:02 ferodom

Fixed in 5.5.1.

misoeli avatar Jun 11 '21 08:06 misoeli

Fixed in 5.5.1.

Is it ES6 supported now?

sowka1995 avatar Jun 11 '21 08:06 sowka1995

If only - only the arrow function was added. A bit too quick on closing here, srroy.

misoeli avatar Jun 11 '21 09:06 misoeli