Login / Register  search  syndication  about

          Kris Halsrud's Blog

Kris Halsrud on development and Integration with CRM and Development

Using IRepository and ICriteria when you have 3 Or conditions

 

I recently ran into a case where I had to query an Entity in SalesLogix to find records where a user was in any one of three fields.  ICriteria has an Or operand but that is for comparing only two fields.  So how do you do three?  With Disjunction.  Here is an example:

Sage.Platform.RepositoryHelper<Sage.Entity.Interfaces.IAccount> repository =
Sage.Platform.EntityFactory.GetRepositoryHelper<Sage.Entity.Interfaces.IAccount>();
Sage.Platform.Repository.ICriteria criteria = repository.CreateCriteria();
criteria.Add(repository.EF.Disjunction()
    .Add(repository.EF.Eq("CreateUser", CurrentEntity.Id.ToString()))
    .Add(repository.EF.Eq("ModifyUser", CurrentEntity.Id.ToString()))
    .Add(repository.EF.Eq("AccountManagerId", CurrentEntity.Id.ToString())));
System.Collections.Generic.IList<Sage.Entity.Interfaces.IAccount> accounts = criteria.List<Sage.Entity.Interfaces.IAccount>();

What's This?
  
Bookmark and Share

About Kris Halsrud

   Kris Halsrud is a Senior Analyst / Developer for Customer FX Corporation.


Related Content
   Problem Showing All Area, Category, and Issue Values in Infor CRM (Saleslogix) Mobile And How to Fix
There is an issue with the Infor CRM (Saleslogix) Mobile client where, if you have a large list of Area,
Posted on Apr 24, 2015 by Ryan Farley to Ryan Farley's Blog
 
   InforCRM 8.1 (formerly SalesLogix) SpeedSearch Repair
If the Speedsearch Server is returning an error "Unable to locate the SpeedSearch Directory" a
Posted on Apr 24, 2015 by Mark Duthoy to SalesLogix Support
 
   Determining User Rights in the Infor CRM (Formerly Saleslogix) LAN Client
I recently had a client ask how to get a query to tell which users have rights to add, edit, and delete v
Posted on Apr 03, 2015 by Kris Halsrud to Kris Halsrud's Blog
 
   How do I wrap text in Textboxes in Infor CRM (formerly Saleslogix)?
Recently an Infor CRM administrator contacted me in regards to many of their textboxes for Notes in the I
Posted on Apr 01, 2015 by Dale Richter to Infor CRM Questions & Answers
 
   InforCRM (formerly Saleslogix) Mobile - Clearing Out Earlier Customizations
If you started with an earlier version of SalesLogix Mobile, let's say version 7.5.4, and customized
Posted on Mar 30, 2015 by Mark Duthoy to SalesLogix Support
 
Comments

No Comments

Leave a Comment

(required)  
(optional)
(required)  
Add
All contents Copyright © 2015 Customer FX Corporation
Customer FX Corporation
2324 University Avenue West, Suite 115
Saint Paul, Minnesota 55114
Tel: 800.728.5783

  Follow @CustomerFX on twitter
Follow the best news, tips, and articles
  Subscribe to Customer FX on youtube
Watch SalesLogix tutorial videos from Customer FX
Login / Register