I have a service that call the new Xrm.WebApi endpoint.
This endpoint return a Promise, which have a nested Promise "json" (documentation), which allows to get the json returned by the service.
From this json I extract some data using the "parseData" method, which return it as an Array of objects.
I want to return an Observable<MyObject[]>
, but all I can get for now is an Observable<Promise<MyObject[]>>
.
My current code looks like the following :
return from(Xrm.WebApi.online.execute(crmRequest).then(
result => {
if (result.ok) {
return result.json().then(json => {
let res : MyObject[]= this.parseData(json);
return res;
});
}
},
error => {
throw error;
}
));
Environment:
- Angular 8.2
- RxJs 6.4