
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>();
Subscribe To Our Newsletter
Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!
You have Successfully Subscribed!