Questions tagged [query-expressions]

Use for assistance when dealing with Microsoft Dynamics CRM QueryExpression objects and their use.

Query expressions are used in methods that retrieve more than one record, such as the IOrganizationService.RetrieveMultiple method, in messages that perform an operation on a result set specified by a query expression, such as BulkDeleteRequest and when the ID for a specific record is not known.

Useful Links:

  1. Build queries with QueryExpression
  2. Code sample
126 questions
0
votes
1 answer

Exception: when trying to use Enumerable.Any Method with Mobile Services query

I have a mobile app build with Xamarin Forms and I'm using Offline Data Sync in Azure Mobile Apps, to enable offline sync in my mobile application so, I have two tables PurchaseOrders PurcahseOrderDetails public…
0
votes
2 answers

Query particular set of records with QueryExpression

Is there a way to build a QueryExpression returning just a particular set of records? I have the following Criteria Types: First: Returns the first n Records (i.e. select top) Last: Returns the last n records Every: Returns every n'th record For the…
0
votes
1 answer

D365 - Get solution list which contains specific string in 'uniquename'

I want to get list of list of solution displayed in DropDown in windows application. So, to get the list of solutions I have written below QueryExpression and added a filter for the same: public EntityCollection GetSolutions(IOrganizationService…
I Love Stackoverflow
  • 6,738
  • 20
  • 97
  • 216
0
votes
1 answer

QueryExpression in a field that shouldn't be null and has particular value

I am trying to write a QueryExpression in C# using the CRM SDK. Where I have a main query and some entities to join. My issue is that 1 of the entities that I join to has a field that I need to filter and cannot be null also. var mainQuery = new…
the.herbert
  • 289
  • 1
  • 5
  • 14
0
votes
1 answer

How to select last n historic records per item using Query Expressions

I need to use Microsoft XRM sdk Query Expression to query a SQL database through windows service and I came across a requirement which I must select last n history records per item which translate to SQL like this: SELECT RecentPrices.ProductId,…
Carl
  • 13
  • 1
  • 5
0
votes
1 answer

Altering Query expression post creation

I am trying to create a new query, then based on certain conditions edit and add to it. I do not know how to do the functions written in brackets [] /* Create the query */ var query = from quote in Query() where quote.documentNum =…
Cornel
  • 72
  • 1
  • 7
0
votes
1 answer

Dynamics CRM QueryExpression nested LinkedEntity

I'm trying to retrieve data from the Contact entity, left joining that to Function entity and then joining the Function to an Account entity. The idea is to use a single query to retrieve contact data plus some extra fields from the other two. I'm…
0
votes
1 answer

query expressions issue in Join()

I am having a issue when writing a below expression var contactDetails = context.contacts .Where(s=>s.contact_code == contactCode) .Join(context.accounts, s => s.) It will not list down the…
Dinesh
  • 97
  • 9
0
votes
1 answer

D365 (On-Prem): Update 'LinkedTo" Entity field with "LinkedFrom" Entity field using QueryExpression

The following is my QE to get the result set with columns I need with foreach loop: using Microsoft.Xrm.Sdk; using Microsoft.Xrm.Sdk.Workflow; using System; using System.Activities; using Microsoft.Xrm.Sdk.Query; namespace UpdtPrntInvQuants { …
J.S. Orris
  • 4,653
  • 12
  • 49
  • 89
0
votes
0 answers

Should I use queryexpression or FetchXML for complicated Dynamics CRM 365 project?

I need to transfer a CRM 4.0 "project" to CRM 365. I have already transferred the data and create all forms. The main "program" in 4.0 is a .dll plugin involve few sql in it, each sql includes multiple "group by", "join". There is an update sql…
autopenta
  • 57
  • 5
0
votes
1 answer

How to do Count(), Group with QueryExpression/ObservableCollection Result with ASP.NET?

In the original version of this ASP.NET program which is for processing data from Dynamics CRM 365, the QueryExpression Result is transferred to ObservableCollection, then final result in xml format. Now I need to add some count() and group by to…
0
votes
1 answer

how can i query my crm data on datetime and ignore the time and just put condition on date?

so i have this query condition below: query.Criteria.AddCondition("fns_enddate", ConditionOperator.Equal, today.ToLocalTime().AddDays(-1)); is there any way to ignore time of datetime field? example: I want this record to come whose fns_endate is…
0
votes
1 answer

How to build a query to get a security role where user X does not exists in Dynamics CRM 2016 C#

I need to update the list of users for a security role. How can I avoid re-associating an user that already has the role assigned? I'm trying to build a query to get the role where user x is not in the role's list of users and then use it for the…
rox
  • 71
  • 2
  • 11
0
votes
3 answers

Find items with same property from list and pick the cheaper of the two items

I have a list of items each with a category and price associated with them. I wanted to know how to create a linq query that will first check for items with of the same category and then check which one of the two is cheaper and remove the more…
0
votes
1 answer

SQL Statement to Query Expression

I want to convert SQL statement to Query Expression. SELECT q.EMailAddress, fe.torecipients, fe.subject, fe.createdon, fe.actualend ,fe.ActivityId FROM QueueItem qi WITH (NOLOCK) inner join Email fe WITH (NOLOCK) ON fe.ActivityId =…
emcedeltate
  • 1
  • 1
  • 1
1 2 3
8 9