11/4/2026 1:35:24 PM
|
| |
| 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!
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.
|
|
|
|
Trouble Adding AccountID to Record in database
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 |
|
|
|
Re: Trouble Adding AccountID to Record in database
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 |
|
|
|
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!
|
|
|
|
|
|
|
|