8/28/2025 5:29:44 AM
|
|
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!
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.
|
|
|
|
Access to Field Level security information
Posted: 09 Feb 09 12:08 PM
|
Hey all!
I need to make certain fields R/W or R/O based on FLS AND Factors within the data... ie. An account with an external account number is RO to everybody and without an external account number I want the fields to revert to FLS. If I program the change in the OnChange event, the R/O part works fine, but the fields that are R/O for some are being set to R/W for everybody... How do I check FLS before I revert these fields to R/W? |
|
|
|
Re: Access to Field Level security information
Posted: 10 Feb 09 7:13 AM
|
The changing of state (R?W, R/O, N/A) of a field under FLS does not have late binding (run-time) capability. It is strictly early binding (design time).. Actually design time at teh time you setup teh SecProfiles and assign them.
All you need to do is set the (bound) text control ReadOnly property true/false on an AXFormChange.. ex: If trim("" & txtTextControl.Text) = "" Then txtTextControl.ReadOnly = True Else txtTextControl.ReadOnly = False End If -- RJLedger - www.rjlSystems.net
|
|
|
|
Re: Access to Field Level security information
Posted: 10 Feb 09 8:52 AM
|
Doesn't work that way on the fly......it's based on SECCODEID/Team and the user's FLS profile for that team BEFORE you get the data and return it to the database......so FLS is invoked before you the developer gain control over the account detail view.....
what we do is walk all control's in the collection and set them to readonly, etc. based on the Account Number (or whatever).....during the AXFormChange.....we don't use FLS. |
|
|
| |
|
Re: Access to Field Level security information
Posted: 10 Feb 09 12:00 PM
|
Thanks, eveyone!!!
This is exactly what I needed!!!
Most likely I will be writting code to use this in my application... if I end up with anything I think might be useful, I will post it here!
Thanks, again! |
|
|
|
Re: Access to Field Level security information
Posted: 11 Feb 09 9:25 AM
|
'''''''' Sub GeneralForms_Security(TheFormPermission) '''' Every ActiveX Form is in the Forms Collection. '''' Each Form has a Controls Collection of all controls on that form. '''' this routine sets control properties by control type to allow/block data entry/user interaction '''' TheFormPermission Parameter can either be Read Write ("RW") or Read Only ("RO") at this time. '''' Data Grids, List Views, Panels, Buttons, and other 'speciality' controls MOST LIKELY will need additional scripts to handle '''' that specific control on that specific form.
DefaultReadOnlyColor = wclLightGray
If TheFormPermission = "RW" OR TRIM(application.basicfunctions.CurrentUserID) = "ADMIN" then g_UserPermission = "RW" KONTROL = FALSE KONTROL_OPP = TRUE TheControlColor = Application.BasicFunctions.StringToColor("Window") ELSE KONTROL = TRUE KONTROL_OPP = FALSE TheControlColor = DefaultReadOnlyColor END IF
For iControl = 0 To ControlCount - 1 Select Case (TypeName(Controls(iControl))) Case "Edit","Memo" Controls(iControl).ReadOnly = KONTROL Controls(iControl).Color = TheControlColor
Case "PickList", "NameEdit" Controls(iControl).ButtonVisible = KONTROL_OPP Controls(iControl).ReadOnly = KONTROL Controls(iControl).Color = TheControlColor
Case "CheckBox" Controls(iControl).Enabled = KONTROL_OPP
Case "ComboBox" Controls(iControl).Enabled = KONTROL_OPP Controls(iControl).Color = TheControlColor
Case "LookupEdit","DateTimeEdit" Controls(iControl).ReadOnly = KONTROL Controls(iControl).ButtonVisible = KONTROL_OPP Controls(iControl).Color = TheControlColor
Case "PopupEdit" Controls(iControl).ReadOnly = KONTROL Controls(iControl).Color = TheControlColor
CASE "LinkEdit" Controls(iControl).ReadOnly = KONTROL Controls(iControl).Color = TheControlColor
Case "Button" ' Do Nothing
Case "DataGrid" ' Do Nothing
Case "Label" ' Do Nothing
Case "Panel" ' Do Nothing
Case "RadioGroup" ' Do Nothing
Case Else ' Do Nothing End Select Next Call ErrorCheckSLX("SetFormSecurity Failed",0,"Form Level Security") End Sub
|
|
|
|
Re: Access to Field Level security information
Posted: 13 Feb 09 4:34 PM
|
Ok... It took me a while to translate fx_rowaccess into something I could use... so I thought I would pass it on.
It's a little function to return the FLS of a field:
Function FieldAccess(strTable, strField, strIDFieldName, strID) Dim intFLS Dim objSLXDB, objRS, strSQL, arFLS
Set objSLXDB = new SLX_DB on error resume next Set objRS = objSLXDB.GetNewRecordset strSQL = "Select " + strField + ", fx_rowaccess() as FLSAccess From " + strTable + " Where " + strIDFieldName + " = '" & strID & "'" 'DNL 'strSQL = "select MemberValue, fx_rowaccess() as FLSAccess from account_2 where accountid = 'A6UJ9A000032'" objRS.Open strSQL, objSLXDB.Connection
FieldAccess = "Unknown" if not(objRS.eof) then reDim arFLS(objRS.Fields("FLSAccess").ActualSize) arFLS= objRS.Fields("FLSAccess").value intFLS =ascb(Midb(arFLS, i+1,1)) if ucase(application.BasicFunctions.CurrentUserID) = "ADMIN" then intFLS = 3 select case intFLS case 0 : FieldAccess = "None" case 1 : FieldAccess = "Read" case 3 : FieldAccess = "Write" end select end if set objRS = nothing set objSLXDB = nothing on error goto 0 end Function
'Just because I'm a lazy typer... Function FieldAccessAcct(strtable, strField) FieldAccessAcct = FieldAccess(strTable, strField, "Accountid", application.BasicFunctions.CurrentAccountID) End Function
HTH! Belinda |
|
|
|
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!
|
|
|
|
|
|
|
|