Help & Support
Contents
Display Legacy Contents

Search:

Home > Impact Suite > How-To Examples > Change Layouts Dynamically

Change Layouts Dynamically

You can create a math function which will change the Layout of the contact details page based on the ID/Status field. This color change will occur automatically when the user navigates to a contact record. 

You can expand this math function onto the Contact, Company, Group or opportunity view and use any field such as Total is greater then $1,000 or status equals open.

Here are four screen shots based on the example below which uses the ID/Status field to drive the Layout.


Tech Note - Requires Impact Suite 5.0.3.4 or better released 10/15/2013

We need to create a math formula to implement this code.

  1. In Act! go to the TOOLS menu and select IMPACT SUITE
  2. Go to the MATH tab on the left side
  3. Click on the [Create Formula] button
  4. Select your result field ( in the screen shot below its 'User 1' )
  5. Then copy and paste this code into the formula area.
  6. Click the SAVE button



NOTE - You may need to paste this code into Notepad.exe then copy from notepad into Impact

Some browsers copy formatting which can cause issues with the paste.

This code should be used when on the CONTACT table

   '-------------------------------------------------------------------------------------------
    ' The code below is the formula for CONTACT. Copy down to and include the 'Return' line.
    '------------------------------------------------------------------------------------------- 
    Dim LayoutName As String = String.Empty

    '--------------------------------------------
    ' Set the layout named based on the ID Status field
    '--------------------------------------------
   Select Case [TBL_CONTACT.ID/STATUS]
        Case "Competitor"
            LayoutName = "CompetitorLayout"
        Case "Consultant"
            LayoutName = "ConsultantLayout"
        Case "Contractor"
            LayoutName = "ContractorLayout"
        Case "Customer"
            LayoutName = "CustomerLayout"
        Case "Employee"
            LayoutName = "EmployeeLayout"
        Case Else
            LayoutName = String.Empty
    End Select

    '--------------------------------------------
    ' If the current layout is the same as
    ' the desired layout just return
    '--------------------------------------------
    If Not Me.HostApplication.UILayoutDesignerManager.GetCurrentLayout(Act.UI.LayoutDesigner.LayoutType.contact).layoutName.ToUpper() = LayoutName.ToUpper() + ".CLY" Then
        '--------------------------------------------
        ' If we have a Layout file name then 
        ' find it in the Layout Manager and set it
        '--------------------------------------------
        If Not LayoutName = String.Empty Then
            For Each LFI As Act.UI.LayoutDesigner.LayoutFileInfo In Me.HostApplication.UILayoutDesignerManager.GetAvailableLayouts(Act.UI.LayoutDesigner.LayoutType.contact)
                If LFI.layoutName.ToUpper() = LayoutName.ToUpper() + ".CLY" Then
                    Me.HostApplication.UILayoutDesignerManager.SetCurrentLayout(LFI)
                    Exit For
                End If
            Next
        End If
    End If

    '--------------------------------------------
    ' Return Nothing so the 'result field' does not get updated.
    '--------------------------------------------
    Return Nothing

    ' End of code 

Contact color, company color, group color, opportunity color., change color



Properties
Article ID:
change_layouts
Views: 232
Created By: jimdurkin
Modified By: [Modified By]
Created Date: 7/23/2014 9:48 AM
Last Modified: 7/23/2014 10:39 AM
Actions
Print This Article
Bookmark
Email This Article
Previous Article
Next Article