The entity model in the web client does not contain an entity which exposes the UserOptions table. SO how can you access the data here?
Well there are 2 ways really. Lets take a look.
#1 Add the USEROPTIONS table to the Saleslogix Application Entities area. Then you can query against it and do finds using the IRepositoryHelper. The following shows how to get the default team for a user:
var userExCode = “SYST00000001”;
Sage.Platform.RepositoryHelper<IUserOptions> repository =
Sage.Platform.EntityFactory.GetRepositoryHelper<IUserOptions>();
Sage.Platform.Repository.ICriteria criteria = repository.CreateCriteria();
criteria.Add(repository.EF.Eq(“USERID”, “XYZ”));
criteria.Add(repository.EF.Eq(“CATEGORY”, “General”));
criteria.Add(repository.EF.Eq(“NAME”, “InsertSecCodeID”));
System.Collections.Generic.IList<Sage.Entity.Interfaces.IUserOptions> options = criteria.List<Sage.Entity.Interfaces.IUserOptions>();
foreach(Sage.Entity.Interfaces.IUserOptions option in options)
{
userExCode = option.OPTIONVALUE;
break;
}
#2 Use something already built in! The UserOptionsService. Here is a sample C# snippet showing how to use it to also find the users default owner:
var userOption = ApplicationContext.Current.Services.Get<IUserOptionsService>();
var userExCode = !string.IsNullOrEmpty(userOption.GetCommonOption(“InsertSecCodeID”, “General”))
? userOption.GetCommonOption(“InsertSecCodeID”, “General”)
: “SYST00000001”;
Note that users may or may not always have a specific option defined. That is why you should always check that like shown in the code snippet above.



