Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
DigitalFlow authored Feb 23, 2017
1 parent b9f035f commit 1255ac3
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ The package name is xrm-webapi-client, check it out:


[![NPM version](https://img.shields.io/npm/v/xrm-webapi-client.svg?style=flat)](https://www.npmjs.com/package/xrm-webapi-client)

### GitHub Release
You can always download the browserified version of this framework by downloading the release.zip file from the latest [release](https://github.com/DigitalFlow/Xrm-WebApi-Client/releases).

Expand Down Expand Up @@ -143,6 +144,29 @@ WebApiClient.Retrieve(request)
});
```

#### Auto expand collection-valued navigation properties
When retrieving collection-valued navigation properties, the expand is being deferred, i.e. you don't retrieve immediate results, but a property ending in "@odata.nextLink" that contains an URL to the results for this expand. You can read more about this [here](https://msdn.microsoft.com/en-us/library/gg334767.aspx#bkmk_expandRelated).
For easing to retrieve these, we can use the `WebApiClient.Expand` function. It takes an array of records and expands all properties, that end in "@odata.nextLink".
You can additionally pass headers to the request, that will be appended to each retrieve request for properties.

```JavaScript
WebApiClient.Retrieve({
entityName: "account",
queryParams: "?$expand=contact_customer_accounts"
})
.then(function(response){
return WebApiClient.Expand({
records: response.value
});
})
.then(function(response){
// Process response
})
.catch(function(error) {
// Handle error
});
```

### Update
Update requests are supported. You have to pass the entity logical name, the ID of the record to update and an update object:

Expand Down

0 comments on commit 1255ac3

Please sign in to comment.