Fedaykin
Fedaykin

Reputation: 4552

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

Upvotes: 0

Views: 808

Answers (2)

winterfruit
winterfruit

Reputation: 273

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.

Upvotes: 2

Matt Dearing
Matt Dearing

Reputation: 9386

Nothing like what you're looking for really exists out of the box. What you linked to kind of works if you can go directly to a view that is already filtered to what you want. Otherwise the closest thing would probably be the OData endpoint. For 2013 it would look something like the following HTTP GET:

https://<CRM SERVER URL>/xrmservices/2011/organizationdata.svc/IncidentSet?$filter=TicketNumber%20eq%20%27CAS-00033-Z3K2P7%27

You could paste that into your browser, but the result will be something like the following (depending on the browser) and not the CRM UI

enter image description here

Upvotes: 3

Related Questions