Hi,
I am having some trouble accessing a custom field on the Opportunity table in a load action (C# Code Snippet Action) on the Insert Opportunity screen (web 8.1). I have built interfaces and also tried a complete rebuild and deploy but no luck.
I am using the following code to get a list of opportunities in descending order as I am only interested in the top one.
Sage.Platform.RepositoryHelper<Sage.Entity.Interfaces.IOpportunity> repository = Sage.Platform.EntityFactory.GetRepositoryHelper<Sage.Entity.Interfaces.IOpportunity>();
Sage.Platform.Repository.ICriteria criteria = repository.CreateCriteria();
criteria.AddOrder(repository.EF.Desc("SEQUENCENUMBER"));
var result = criteria.List<Sage.Entity.Interfaces.IOpportunity>();
Then I am trying to access my custom field (sequencenumber) using the following
Sage.Entity.Interfaces.IOpportunity opportunity = (Sage.Entity.Interfaces.IOpportunity)result[0];
var nextNumber = ((int)opportunity.sequencenumber + 1)
The error I am seeing is "could not resolve property: SEQUENCENUMBER of: Sage.SalesLogix.Entities.Opportunity."
I appreciate any ideas as to what I may be doing wrong, or if there is a better way to select the top 1 opportunity and then access the custom field.
Thanks in advance,
Lee |