Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Monday, August 18, 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: Trouble Adding AccountID to Record in database
George Jensen
Posts: 6
 
Trouble Adding AccountID to Record in databaseYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 Apr 09 12:33 PM
I have project going where I want to track the movement of an Asset from one Account to Another.

I created a 1 to M off of the now Main view Entity called Assets

At the top I have two fields, one to look-up the new Account, and the other to allow the user to select a reason for the move. There is also a button that starts the following C# Snippet.

if (curntAccount.LookupResultValue != string.Empty)
{
Sage.Entity.Interfaces.IAccountProduct asset = this.BindingSource.Current as Sage.Entity.Interfaces.IAccountProduct;
Sage.Entity.Interfaces.IAuditTrail audit = Sage.Platform.EntityFactory.Create<Sage.Entity.Interfaces.IAuditTrail>();

string newAccount = curntAccount.LookupResultValue.ToString();

audit.PreviousAccountID = asset.AccountId.ToString();
audit.CurrentAccountID= curntAccount.LookupResultValue.ToString();
audit.ReasonMoved = reason.PickListValue;
audit.Save();

asset.AccountId = Sage.Platform.EntityFactory.GetById((string)newAccount);


Sage.Platform.WebPortal.Services.IPanelRefreshService refresher = PageWorkItem.Services.Get<Sage.Platform.WebPortal.Services.IPanelRefreshService>();
if (refresher != null)
{
asset.Save();
refresher.RefreshAll();
}
}
else
{
this.DialogService.ShowMessage("You must select the Account you wish to move the Asset to prior to selecting the move button.");
}

When I build, deploy, and navigate to my Asset Entity I receive the following error:

c:\Inetpub\wwwroot\CFX_751_Power2Asset_WebOnly\SLXClient\SmartParts\AccountProduct\AssetAuditList.ascx(156): error CS0411: The type arguments for method 'Sage.Platform.EntityFactory.GetById(object)' cannot be inferred from the usage. Try specifying the type arguments explicitly.

Line 156 is this:

asset.AccountId = Sage.Platform.EntityFactory.GetById((string)newAccount);

What am I doing wrong?

Thanks in advance - Geo
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Trouble Adding AccountID to Record in databaseYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 Apr 09 1:53 PM
Hey George,

The problem, as indicated, is with this line:

asset.AccountId = Sage.Platform.EntityFactory.GetById((string)newAccount);


You are not telling it which type of entity you are getting by ID. Change the line to this:

asset.AccountId = Sage.Platform.EntityFactory.GetById<Sage.Entity.Interfaces.IAccount>(newAccount);


-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): 8/18/2025 3:55:45 AM