Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Saturday, July 5, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Web Forums - SalesLogix Web Platform & Application Architect
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Web Platform & Application Architect | New ThreadView:  Search:  
 Author  Thread: Problem with GetByMethod DataGrid
Jeremy Couzens
Posts: 10
 
Problem with GetByMethod DataGridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Jul 09 2:04 PM
I have found allot of related posts on the IQueryable and IExpressionFactory uses, but I can't seem to find what is specificly wrong with this code. I'm trying to return an IList to a datagrid that contains a list of TicketActivities. Here is the code....

#region Usings
using System;
using Sage.Entity.Interfaces;
//using Sage.Form.Interfaces;
using Sage.Platform.Repository;
using Sage.Platform;
using System.Collections.Generic;
#endregion Usings

namespace Sage.BusinessRules.CodeSnippets
{
public static partial class TicketBusinessRules
{
public static void GetWorkPerformedStep( ITicket ticket, out IList result)
{
IRepository repository = EntityFactory.GetRepository();
IQueryable qry = (IQueryable)repository;
IExpressionFactory ef = qry.GetExpressionFactory();

result = qry.CreateCriteria()
.Add(ef.Eq("TicketId", ticket.Id.ToString()))
.Add(ef.Eq("ActivityTypeCode", "Work Performed"))
.List();

}
}
}


The error that gets returned is... "could not resolve property: TicketId of: Sage.SalesLogix.Entities.TicketActivity" ...I know that this usualy means that there is a Reference problem, but I can't find anything missing from my Usings, and the Codesnippet XML seems to have all of the needed references. Here is the Codesnippet.xml References....

%BASEBUILDPATH%\assemblies\Sage.Platform.dll
%BASEBUILDPATH%\assemblies\NHibernate.dll
%BASEBUILDPATH%\assemblies\Sage.Platform.Application.dll
%BASEBUILDPATH%\assemblies\Microsoft.Practices.ObjectBuilder.dll
%BASEBUILDPATH%\assemblies\Sage.Platform.Configuration.dll
%BASEBUILDPATH%\interfaces\bin\Sage.Entity.Interfaces.dll
%BASEBUILDPATH%\formInterfaces\bin\Sage.Form.Interfaces.dll

I have no doubt that I'm missing somthing trivial in my code, but I'm at a loss...

Thanks!
[Reply][Quote]
Mike LaSpina
Posts: 116
 
Re: Problem with GetByMethod DataGridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Jul 09 2:43 PM
Jeremy,
Set the return type of your method to 'object' instead of 'IList'. That is likely your problem. Note you'll have to type it in as it's not available in the list.
[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: Problem with GetByMethod DataGridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Jul 09 2:47 PM
The TicketActivity does not expose a TicketId property.

You may need to change that criteria to something like this:
.Add(ef.Eq("Ticket", ticket));
[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: Problem with GetByMethod DataGridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Jul 09 2:50 PM
Quote:
Originally posted by Mike LaSpina

Jeremy,
Set the return type of your method to 'object' instead of 'IList'. That is likely your problem. Note you'll have to type it in as it's not available in the list.


The error message that he is getting is clear, it cannot resolve the TicketId Property because the TicketActivity doesn't expose such property.
[Reply][Quote]
Mike LaSpina
Posts: 116
 
Re: Problem with GetByMethod DataGridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Jul 09 2:58 PM
Note that id fields are almost always exposed as 'Id' in the model i.e. Ticket.Id.
[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: Problem with GetByMethod DataGridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Jul 09 3:03 PM
Agree, but the error message isn't for the TicketActivity.Id but rather for TicketActivity.TicketId. The Ticket Activity does not expose a TicketID property, but rather a Ticket.

Thus my solution was to change:
.Add(ef.Eq("TicketId", ticket.Id.ToString()))

Into:
.Add(ef.Eq("Ticket", ticket))





[Reply][Quote]
Jeremy Couzens
Posts: 10
 
Re: Problem with GetByMethod DataGridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Jul 09 3:18 PM
Mike,

Same result. I assume that I needed to change the Return type in the business rule properties and the declaration of the return object in the code.

In case I missed something stupid on how I configured the DataSource, I have the properties set as follows...

Entity Type = TicketActivity
Generate Member = True
GetByMethod = GetWorkPerformed
Is Collection = True
Source = Ticket
Use Smart Select = False
[Reply][Quote]
Jeremy Couzens
Posts: 10
 
Re: Problem with GetByMethod DataGridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Jul 09 3:21 PM
Ignore my last reply. You guys are fast! Let me try the object. I neglected to remember that Parent ID's are usualy exposed as Entity Relationships (like Owner instead of Seccodeid)...

I'll try this out...
[Reply][Quote]
Jeremy Couzens
Posts: 10
 
Re: Problem with GetByMethod DataGridYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Jul 09 3:35 PM
Worked like a champ!

Thanks!
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 7/5/2025 11:06:39 AM