dynamics-crm Using Web API with jQuery Using select to reduce the number of fields


For performance reasons you should minimize the number of fields you are requesting from the API. You can use the select property to do so.

This example fetches the name property of all accounts:

    url: Xrm.Page.context.getClientUrl() + '/api/data/v8.0/accounts?$select=name',
    headers: { 
        'Accept': 'Application/json'
}).done(function (result) {
    $.each(result.value, function (key, value) {
        var lastname = value.primarycontactid.lastname;