Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, February 21, 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: Error while building a custom property to account entity
Sandeep Gaykhe
Posts: 9
 
Error while building a custom property to account entityYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Feb 08 7:07 AM
Hi,
I am trying to create Account level property which would return me collection of accounts(SLX ver 7.2.1). I am somewhat confused with the joints hence opted for this path.
Here is what I had done for a custom property
=======================================================================
public virtual System.Collections.Generic.ICollection AgencyClients
{
get
{
Sage.Platform.Data.IDataService connService = Sage.Platform.Application.ApplicationContext.Current.Services.Get();
String connection = connService.GetConnectionString();
System.Data.SqlClient.SqlDataReader reader;
System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(connection);
conn.Open();
System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand();
string vsql = "Select AccountId from C_ACCOUNT_EXTENSION where CLIENTAGENCYID='" + this.Id +"'";
command.CommandText = vsql;
command.Connection = conn;
reader = command.ExecuteReader();
if (reader.HasRows)
{
while (reader.Read())
{
IAccount account = EntityFactory.GetById(reader[0]);
AgencyClients.Add(account);
}
}
return AgencyClients;
}
}
==========================================================================
I am getting an error on the line where I am trying to access dataservice. Error I am getting while building a platform is as follows

ERROR - c:\Documents and Settings\Administrator\Application Data\Sage\Platform\Output\implementation\Account.cs(449,70):The type or namespace name 'Application' does not exist in the namespace 'Sage.Platform' (are you missing an assembly reference?)

Any help would be greatly appreciated. Is there any other alternative to achieve this?

Thanks and Regards,
Sandeep Gaykhe
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Error while building a custom property to account entityYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Feb 08 3:56 PM
Could it be that the following line is no longer in your codesnippets.xml file?

<reference>%BASEBUILDPATH%\assemblies\Sage.Platform.Application.dll</reference>


Also, you're trying to assign the values to the property, instead create a local IList collection and assign the accounts to that then return it. Beware, you're not disposing of your disposable objects. Also note, "Id" is an object, not a string, so you'll need to call ToString() on it to append

You could do that as well without the need to make the connection, something like this:

using (SessionScopeWrapper wrapper = new SessionScopeWrapper())
{
IQueryable repository = (IQueryable) EntityFactory.GetRepository<IAccount>();
IExpressionFactory expressionFactory = repository.GetExpressionFactory();
ICriteria criteria = repository.CreateCriteria();

// guessing the extension entity name and property here
// also, not sure if you can reference the related extension entity
// property in the query like this, but i'll leave that for you to try
criteria.Add(expressionFactory.Eq("AccountExtension.ClientAgencyID", this.Id.ToString()));
return criteria.List<IAccount>();
}


Something like that.

-Ryan
[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): 2/21/2025 6:14:44 AM