Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Monday, June 30, 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: Disable chexkbox for specific users
Andrew Grandin
Posts: 272
 
Disable chexkbox for specific usersYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Apr 10 5:31 AM
Hi All,

I have a checkbox on a form that i only want certain users to be able to check.

Im trying to create a C# snippet to do the job at the moment but im having some trouble.

Could anyone help or point me in the right direction please. Working on it myself ive come to the following code to find out the current logged on user but it returns errors.

Sage.Platform.Security.UserService userService = Sage.Platform.Application.ApplicationContext.Current.Services.Get(userService) as Sage.Platform.Security.UserService;
IUser user = userService.GetUser();
[Reply][Quote]
Andrew Grandin
Posts: 272
 
Re: Disable chexkbox for specific usersYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Apr 10 6:06 AM
I have also tried this:

Sage.Platform.Security.IUserService userService = Sage.Platform.Application.ApplicationContext.Current.Services.Get();
string user = userService.UserName;

which gives me the error:

The type arguments for method 'Sage.Platform.Application.ServiceCollection.Get()' cannot be inferred from the usage. Try specifying the type arguments explicitly.
[Reply][Quote]
Tony Joanes
Posts: 71
 
Re: Disable chexkbox for specific usersYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Apr 10 6:09 AM
Hi Andrew

I have used the following:

SLXUserService service = ApplicationContext.Current.Services.Get() as SLXUserService;
User currentUser = service.GetUser();

You can then access the current user.

I have also used the following to get a list of teams that the user is in.
IList teamlist =
Sage.SalesLogix.Security.Owner.GetTeamsByUser((Sage.SalesLogix.Security.User)currentUser );

[Reply][Quote]
Andrew Grandin
Posts: 272
 
Re: Disable chexkbox for specific usersYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Apr 10 6:15 AM
Thanks for your reply. This is similar to one of my early trys but i get the error:

The type or namespace name 'Security' does not exist in the namespace 'Sage.SalesLogix'

when i look at my line "using Sage.SalesLogix......." the only option that follows the "." is API.i also get:

The type or namespace name 'SLXUserService' could not be found

and the original:

The type arguments for method 'Sage.Platform.Application.ServiceCollection.Get()'
[Reply][Quote]
Tony Joanes
Posts: 71
 
Re: Disable chexkbox for specific usersYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Apr 10 7:30 AM
I believe you can do it this way too.

IUserService us = ApplicationContext.Current.Services.Get();
IUser user = EntityFactory.GetById(us.UserId);
[Reply][Quote]
Andrew Grandin
Posts: 272
 
Re: Disable chexkbox for specific usersYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Apr 10 7:36 AM
Thanks for your reply again Tony i really appreciate your time.

Unfortunately i still get the error:

The type arguments for method 'Sage.Platform.Application.ServiceCollection.Get()' cannot be inferred from the usage

along with:

The name 'EntityFactory' does not exist in the current context
[Reply][Quote]
Tony Joanes
Posts: 71
 
Re: Disable chexkbox for specific usersYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Apr 10 7:46 AM
You need to use:
Sage.Platform.Application.ApplicationContext.Current.Services.Get();

Not, Sage.Platform.Application.ServiceCollection.Get();

Make sure you fully qualify or add using statements:

eg Sage.Platform.EntityFactory
or add
Using Sage.Platform;


[Reply][Quote]
Andrew Grandin
Posts: 272
 
Re: Disable chexkbox for specific usersYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Apr 10 8:01 AM
That is the line i use but i get the same error

also any tutorial, help file or example of this sort of thing i can find uses:

Sage.SalesLogix.Security.SLXUserService..... but i cant add Sage.SalesLogix.Security as a using.

The only choice i get is Sage.SalesLogix.API Am i missing something??????
[Reply][Quote]
Tony Joanes
Posts: 71
 
Re: Disable chexkbox for specific usersYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Apr 10 8:05 AM
sorry was doing it from memory, you need to specify the service that you are getting.

Sage.Platform.Application.ApplicationContext.Current.Services.Get();
[Reply][Quote]
Andrew Grandin
Posts: 272
 
Re: Disable chexkbox for specific usersYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Apr 10 9:32 AM
Finally it works!!! Next part (sigh) is how i control the Enabled property of the check box on the form through my code snippet? SO now i have the code to get the currently logged on user, If the user is not "user1" then disable the check box.

Let the confusion begin (i miss 7.2 )
[Reply][Quote]
Jeff Cook
Posts: 2
 
Re: Disable chexkbox for specific usersYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 May 10 1:13 PM
Did you end up adding an Assembly Reference to Sage.SalesLogix.Security.dll?
[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): 6/30/2025 1:36:06 PM