Search code examples
dynamics-crmdynamics-crm-2013

DynamicsCRM - Search cases (or any other entity) using url querystring


I would like to query Cases on my on-premises DynamicsCRM using a URL querystring.

Something like this:

https://mysvr/foo.aspx?entity=case&query=somecasenumber

I would like to query the field 'Case Number', please notice that it is only an example, anything that can fulfill this need is welcome (since it uses a url to make the query).

I took a look at this link with no luck: https://msdn.microsoft.com/en-us/library/gg328483.aspx

It seems something very straight forward to have but I can´t find any info on this.

Thanks in advance


Solution

  • You can open a record via the GUID

    https://<CRM URL>/main.aspx?etn=incident&id={<Case GUID>}&newWindow=true&pagetype=entityrecord
    

    Using Matt's answer above can fetch the GUID. (See below code with snipped from the OData endpoint

    <id>https://<CRM URL>/XRMServices/2011/OrganizationData.svc/IncidentSet(guid'<Your entities GUID is here>')</id>
    

    Once you have the GUID, the URL will take the user directly into the record.

    It's a few more steps than I'd personally like, but using some fancy JavaScript, you can perform the lookup, fetch the GUID and create the URL.

    An amazing resource for playing with CRM is the open source Chrome plugin LevelUp for Dynamics CRM. The source code there will give you a start into https://github.com/rajyraman/Levelup-for-Dynamics-CRM

    I am not the cleanest JavaScript coder, so I will not scar your eyes with my "unique style" however I hope I have given you a good starting point.