Using Team Membership for Dynamic view display

On occasion, I’ve had requirements to display different ‘versions’ of a form for one group of users over another.

While field level security can be used to limit readwrite access to fields by using security profiles, another option is to use team membership to determine how to configure controls on the view itself.  In this example, I’ll outline how to show different configurations of the Account Detail view based on a users team membership.

I’ve added a new team called ‘Sales’ to SalesLogix, and populated the team with a number of users.  First of all, we’ll need to determine if the currently logged in user belongs to the new ‘Sales’ team in SalesLogix.  This requires a basic knowledge of how that information is stored in SalesLogix.  The SECCODEID table contains definitions for teams in SalesLogix.  The table ‘SECRIGHTS’ funcitons as a hash-table, containing a SECCODEID value along with a ACCESSID value which contains a userid for a user which belongs to the team. 

Within the WhenChange event of the Account Detail view I’m using the GetField function contained in the SLX Data Access script already included in the view to get a count from secrights where the accessid is the currentuserid and the seccodeid matches the team’s seccodeid that we are looking for.  The GetField function simply returns a value from a SQL statement passed to the function.  GetField takes three parameters; Field, Table and a Where clause for the statement.  I’ve assigned the Table and Where parameters to variables here for readability:


    Dim bIsSales
    Dim sSqlTable
    Dim sSqlWhere

    sSqlTable = “secrights a inner join seccode b on a.seccodeid = b.seccodeid”
    sSqlWhere = “b.seccodesc = ‘Sales’ and a.accessid = ‘” & Application.BasicFunctions.CurrentUserID & “‘”
    bIsSales = False

    If GetField(“count(a.secrightsid)”, sSqlTable, sSqlWhere) Then
        bIsSales = True
    End If

At this point, the bIsSales variable will be True if the currently logged in user belongs to the Sales team.  All we need to do now is adjust properties in the Account detail view via code based on the value of that variable.  In this case, I just want to hide the fields normall contained on the right hand side of the view, and replace them with a couple of Sales-specific fields.  The easiest way to do this is to cut and paste those fields onto a new panel.  I also created a panel to contain the Sales fields.  The bevel properties of the panels have been set to None so that they do not contain borders.


Once the panels are created, I move the Sales panel so that it is in the same position as the panel containing the standard fields.  All we need to do now is to show  the panel we want while hiding the panel we don’t: (again, this is contained on the WhenChange event of the form)

    pnSalesPanel.Visible = bIsSales
    pnSalesPanel.Enabled = bIsSales
    pnStandard.Visible = not bIsSales
    pnStandard.Enabled = not bIsSales

That’s all there is to it!  This is a very simple example of modifying the form, but your options are pretty much limitless.  Using the Visible and Enabled properties of individual controls along with their Left and Top properties, you can include code to format the view in any way you would like.  Feel free to experiment.


Thanks for reading.  I hope you find this example helpful.  [:)]


Jason Buss

Jason is a senior application developer with Customer FX.

Submit a Comment

Your email address will not be published.

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!