Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Tuesday, November 26, 2024 
 
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!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Hide edit field to everyone but three people
Paula Shuler
Posts: 22
 
Hide edit field to everyone but three peopleYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 14 Oct 15 10:58 AM

Hello again!


I am looking to add a field in the opportunities to put the comission our company gets for certain products, however only about three maybe four people total in the company should be able to see this data. 


I want to hide the label and the field. I'm sure this is possible, I just honestly have no clue how to go by doing this. Any feedback is truly appreciated!!!

[Reply][Quote]
Lee Harris
Posts: 23
 
Re: Hide edit field to everyone but three peopleYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 15 Oct 15 3:19 AM

Hi Paula,


A good way to achieve this that I have used in the past, is to create a new Team within the Administrator and add all the users who should have access to your field.


Then within the Architect, you can add script to the onChange event of the Opportunities screen that queries the database to see if the logged in user is a member of the Team that has access. If they are then show the field, if not then hide it. The good thing about using teams, is once its in place you can give/remove access to any user very easily.


The tables you will need to look at are the SECRIGHTS and SECCODE tables. Teams have a SECCODETYPE of "G".


Hope that helps


Lee

[Reply][Quote]
Paula Shuler
Posts: 22
 
Re: Hide edit field to everyone but three peopleYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 15 Oct 15 10:42 AM

That certainly makes sense! Do you happen to have an example code of how that would work? Do you think I would be using an IF THEN statement? I'll fiddle around Architect to see what I can find to copy. I can understand code, but it's hard for me to just create it haha

[Reply][Quote]
Lee Harris
Posts: 23
 
Re: Hide edit field to everyone but three peopleYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 15 Oct 15 11:20 AM

Hi Paula,


Agreed, starting with a blank canvas is always tricky. This should help get you started.


The SQL you will need in order to determine if a user is a member of a specific team is as follows:


select accessid from secrights where seccodeid = 


(select seccodeid from seccode where (UPPER(seccodedesc) = 'TEAMNAMEHERE') 


and (seccodetype = 'G')) and (accessid = 'USERIDHERE')


You will need to create a recordset in order to access the results of this within script. There should be plenty of examples of this in the main detail forms.


Once you have this function working you could add it to a common script allowing you to use it across your entire system whenever you may need to display fields based on Team access.


If you need any further assistance with this requirement or any other modifications feel free to send me a message and I'll see what I can do to help.


Regards,


Lee

[Reply][Quote]
Paula Shuler
Posts: 22
 
Re: Hide edit field to everyone but three peopleYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 15 Oct 15 12:33 PM

Hi Lee,


Thanks for trying to help me out through this. I think this part is a little over my head and very confusing. I truly have no idea where I should be putting this code, how or what. 


I just don't even know where to begin! I assume I have to assign some variable which determines if the user is part of the team I created (named Admin) and then if so, then I can show that label/field and if not, hide it. 


I just have no clue what I am doing anymore Cry


 


---


After doing some reading of code, looks like I found this:


 


 


Set objRS = objSLXDB.GetNewRecordSet

strSQL = "Select ACCOUNT From ACCOUNT Where ACCOUNTID = '" & Trim(txtResellerID.Text) & "'"  'DNL

objRS.Open strSQL, objSLXDB.Connection

If Not (objRS.BOF And objRS.EOF) Then

ppeReseller.Text = "" & objRS.Fields("ACCOUNT").Value  'DNL

Else

ppeReseller.text = ""

End If

objRS.Close

Set objRS = Nothing

So it looks like I have to access the SQL somehow.. grr this is harder than I thought.


 

[Reply][Quote]
Lee Harris
Posts: 23
 
Re: Hide edit field to everyone but three peopleYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Oct 15 6:01 AM

Hi Paula,


You will need to create a new method in the OnChange event of your Opportunity form (if one does not already exist) and use the following code..


 


 


<p>Dim objRS, strSQL, objSLXDB

 


Dim boolTeamMember

 

boolTeamMember = false


Set objSLXDB = New SLX_DB


Set objRS = objSLXDB.GetNewRecordSet

 

strSQL = "select accessid from secrights where seccodeid = " & _


  "(select seccodeid from seccode where (UPPER(seccodedesc) = 'ADMIN') " & _


  "and (seccodetype = 'G')) and (accessid = '" & Application.BasicFunctions.CurrentUserID & "')"

 

objRS.Open strSQL, objSLXDB.Connection

 

If Not (objRS.BOF And objRS.EOF) Then


boolTeamMember = (objRS.Fields(0).Value & "" = Application.BasicFunctions.CurrentUserID)


Else


boolTeamMember = False


End If

 

'If boolTeamMember = True then they are in the ADMIN team


'Hide/Show your fields here...


If boolTeamMember Then


 

Else

 


End if


objRS.Close


Set objRS = Nothing


Set objSLXDB = Nothing


 


 


I would also suggest reading through the help within SalesLogix Architect and getting yourself a copy of DevLogix (development book for SalesLogix) so that you have a better understanding of what the above code is doing. Depending on your experience it may also be worth looking at some tutorials for vbScript (http://www.w3schools.com/asp/vbscript_default.asp).


Hope that helps!


 


Regards,


Lee


(QGate Software Ltd)

[Reply][Quote]
Brian Segers
Posts: 69
 
Re: Hide edit field to everyone but three peopleYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Oct 15 1:46 PM

Hi Paula,


One thing to be aware of is all of these methods will allow the field to be seen in Groups. If it is important that is is truly hidden then you cna create a new field level security profile and set that field to no access for the normal profiles and create a new profile that has access. You can learn about Field level security form the help or contact your partner.


 

[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 © 2024 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): 11/26/2024 3:02:48 AM