Sage SalesLogix
  • Contact Us
  • Sage North America
800-643-6400
Welcome Twitter Facebook LinkedIn
Community Home Blogs Share Ideas Search Request Access Resources
Reply
Copper Super Contributor
kennedystephen
Posts: 21
Registered: 12-08-2009

How To Get Current SalesLogix User?

I need to get the current user's User object. Seems like I've almost got it. I don't understand why this is so hard.

 

I am using this code:
SLXUserService service = ApplicationContext.Current.Services.Get() as SLXUserService;
User currentUser = service.GetUser();

 

But I keep getting consecutive error messages about adding 2 or 3 new references. What all references are required? Security? Entities? Sage.SalesLogix? ugh.

 

I've also tried using the API namespace. That current user it returns cannot be converted into a normal IUser.

 

Is there a better/easier way that I am missing?

Please use plain text.
Bronze Super Contributor
garnold
Posts: 204
Registered: 03-10-2009

Re: How To Get Current SalesLogix User?

Please use plain text.
Copper Super Contributor
kennedystephen
Posts: 21
Registered: 12-08-2009

Re: How To Get Current SalesLogix User?

Thanks for the quick reply..

 

Sage.SalesLogix.Security is not showing up in Intellisense. I imagine it's not a valid namespace.

 

If I add a reference to it (Sage.SalesLogix.Security.dll), I get into a cascading effect of needing to add multiple other references. Does that seem right?

 

Thanks.

Please use plain text.
Bronze Super Contributor
garnold
Posts: 204
Registered: 03-10-2009

Re: How To Get Current SalesLogix User?

Sorry I got side tracked. Ok so where are you trying to add this code? Is it in a business rule? This is pretty standard code and works just about anywhere. I have personally used it tons of times so don't fret we will get it working :smileyhappy: I just need a little more info on what you are trying to do and where in the product you are trying to do it.

Sr. Sales Engineer
Gene Arnold
Please use plain text.
Bronze Elite Contributor
RJSamp
Posts: 482
Registered: 03-24-2009

Re: How To Get Current SalesLogix User?

<rant>

This is just another example of not enough design being replaced by way too much C# .net code.......why don't we simply write this out in Assembly language and be done with it?

 

Could someone please explain to me why SLX couldn't have a simple statement like the following:

 

      string MyCurrentUserID = Sage.SalesLogix.GetInfo.CurrentUserID;

 

As a developer, I don't wan't tohave to worry about boxing, nulls, structs, inheritance, etc. just to cough up the logged in user's char 12 USERID. You can have all the happy code layers, methods, interfaces, classes, Lists, running behind the scenes to your non 4GL, non Visual coding content .....

 

Now that we have the userId, I need to see if they're in a Team.....

 

Sometimes less is more.......

</rant>

 

 

 

RJ Samp
Please use plain text.
Copper Contributor
ChrisGrant
Posts: 28
Registered: 07-04-2009

Re: How To Get Current SalesLogix User?

You mean like

 

BusinessRuleHelper.GetCurrentUser().Id.ToString();

 

Enjoy

 

Chris

Please use plain text.
Copper Elite Contributor
nrice
Posts: 81
Registered: 07-17-2011

Re: How To Get Current SalesLogix User?

When I attempt to add Sage.SalesLogix.BusinessRules.dll in the AssemblyReference Collection Editor I get an error:

 

Could not load exported type data for assembly 'Sage.SalesLogix.BusinessRules, Version=7.5.4.7097, Culture=neutral, PublicKeyToken=null' and type 'Sage.SalesLogix.Account.Rules'. (ActiproSoftware.SyntaxEditor.Addons.DotNet.Net20)

 

Could not load file or assembly 'Sage.SalesLogix.Services.PotentialMatch, Version=7.5.4.7097, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. (mscorlib)

 

Am I missing dll's?

Please use plain text.