derekfinlinson / xrm-webapi

Dynamics 365 Web Api TypeScript module
MIT License
27 stars 13 forks source link

Require statement #10

Closed ghost closed 7 years ago

ghost commented 7 years ago

So since I haven't found a helper function for require is not a native function, at least not in browsers. It may work in nodejs though. So this will not work unless you specify another dependency to a module loader.

var es6_promise_1 = require("es6-promise");
derekfinlinson commented 7 years ago

I've actually never tried just using the module as is. I use webpack to bundle it up with any necessary code. Have you tried just loading it in the form? TypeScript should transpile it down to ES5 so I assume it would work.

ghost commented 7 years ago

No I haven't tried it, was just having a look at the repo. So how would you use the xrm-webapi lets say if you had to add some javascript to an account form? I would be interested in the workflow with javascript files on your side.

derekfinlinson commented 7 years ago

These are both very much a WIP but if you take a look at xrm-templates and generator-xrm-webreource you can sort of see the flow. Need to get some documentation up.

Basically I write everything in TypeScript so I can use the xrm typings. Then I use webpack to bundle each script (such as AccountForm.ts) along with it's dependencies into a single file. Then I use David Yacks gulp-webresource to automatically upload to CRM.

ghost commented 7 years ago

Haven't heard about the gulp-webresource thing yet, I will have a look. So how did you persuade your superiors that you are allowed to use TypeScript in the first place :D

derekfinlinson commented 7 years ago

Fortunately, we're a pretty small shop with only a handful of developers so don't have much in the way of an org hierarchy. Even if you don't use most of it's cooler features, it's worth it for the Xrm typings alone. It's saved me many a trip to the Xrm.Page documentation.

ghost commented 7 years ago

Does the adal auth also works against on premise?

derekfinlinson commented 7 years ago

I wouldn't think so since I believe it's specific to Office 365 OAuth authentication