Dynamics 365 OData Cheat Sheet

  • Returns Email Addresses of 5 Contacts
    contacts?$select=emailaddress1&$top=5
  • Returns Contacts modified after April 5, 2018
    contacts?$filter=modifiedon ge 2018-04-05<span id="mce_SELREST_start" style="overflow: hidden; line-height: 0;"></span>
  • Returns Contacts modified between April 5, 2018 and April 6, 2018
    contacts?$select=lastname,modifiedon&$filter=modifiedon ge 2018-04-05 and modifiedon le 2018-04-06
  • Returns Accounts with names that begin with the letter ‘A’
    accounts?$select=name&$filter=startswith(name, 'A')
  • Returns Accounts with names that contains the word ‘toy’
    accounts?$select=name&$filter=contains(name,'toy')
  • Returns Accounts with an Address 1 in the state of North Carolina or Washington
    accounts?$filter=contains(address1_stateorprovince,'NC') or contains(address1_stateorprovince,'WA')
  • Returns the name of Accounts that contain ‘toy’ in the name and the first and last name of the primary contact
    accounts?$select=name&$filter=contains(name,'toy')&$expand=primarycontactid($select=firstname,lastname)<span id="mce_SELREST_start" style="overflow: hidden; line-height: 0;"></span>

Dynamics 365/CRM Functions

  • Returns Leads created in the last 7 days
    leads?$filter=Microsoft.Dynamics.CRM.LastXDays(PropertyName='createdon',PropertyValue=7)

    or

    leads?$filter=Microsoft.Dynamics.CRM.LastXDays(PropertyName=@p1,PropertyValue=@p2)&@p1='createdon'&@p2=7
  • Returns the organization resources
    RetrieveOrganizationResources
  • Retrieve the organization name of the Dynamics 365 instance
    RetrieveCurrentOrganization(AccessType=Microsoft.Dynamics.CRM.EndpointAccessType'Default')

    or

    RetrieveCurrentOrganization(AccessType=Microsoft.Dynamics.CRM.EndpointAccessType'0')