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
   How do I remove users from my Infor CRM system (formerly SalesLogix)?
I had an Administrator ask me for the steps they needed to take in order to remove a user from the Infor
Posted on May 08, 2015 by Dale Richter to Infor CRM Questions & Answers
 
   Infor CRM (Formerly Saleslogix) v8.1 update 03 and 05- Uncaught Error Scheduling Contact Processes
 In the Infor CRM (formerly Saleslogix) web client, under the Contact area you have the ability to s
Posted on May 07, 2015 by Kris Halsrud to Kris Halsrud's Blog
 
   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
 
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