Compiling a C# DLL to Populate a Datagrid in SalesLogix v7.5.1

Question: I am compiling a C# dll to populate a datagrid in SalesLogix v7.5.1.  I would like to include the Assigned to, but it is unable to resolve the property AssignedTo.OwnerDescription.  Here is my code:
 
Sage.Platform.RepositoryHelper rep = Sage.Platform.EntityFactory.GetRepositoryHelper();
Sage.Platform.Repository.ICriteria criteria = rep.CreateCriteria();
criteria.Add(rep.EF.Eq(“Contact”, contact));
criteria.SetProjection(rep.PF.ProjectionList()
.Add(rep.PF.Property(“TicketNumber”))
.Add(rep.PF.Property(“StatusCode”))
.Add(rep.PF.Property(“CreateDate”))
.Add(rep.PF.Property(“CompletedDate”))
.Add(rep.PF.Property(“UrgencyCode”))
.Add(rep.PF.Property(“AssignedTo.OwnerDescription”))
.Add(rep.PF.Property(“Account.Account”))
.Add(rep.PF.Property(“Subject”))
);
 
How can I do this?
 
Answer: You will need to create a join and then handle your projections with the prefix of the entity name.  Example:
 
IQueryable query = (IQueryable)EntityFactory.GetRepository();
IExpressionFactory expressions = query.GetExpressionFactory();
IProjections projections = query.GetProjectionsFactory();

ICriteria criteria = query.CreateCriteria(“account”)
.CreateCriteria(“Address”, “address”, JoinType.InnerJoin) <<– here I add address to my list of projections
.SetProjection(projections.ProjectionList()
.Add(projections.Property(“account.Id”))
.Add(projections.Property(“account.AccountName”))
.Add(projections.Property(“address.Address1”))
.Add(projections.Property(“address.City”))
.Add(projections.Property(“address.State”))
.Add(projections.Property(“address.Country”))
.Add(projections.Property(“account.MainPhone”))
).Add(expressions.Eq(“account.ResellerID”, account.Id));

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) news and product updates!

You have Successfully Subscribed!