Changing the Layout Dynamically

Root > 3. Customisation

 

 

    Follow WiredContact on Twitter


Changing the Layout Dynamically

 

You can dynamically change the WiredContact layouts based on several criteria by using a <#LAYOUTTEST function. This function will allow you to run a test based on the below criteria and then load a different HTML page if there is a match.  You may have several tests in a single template. The first match will load the specified page.

 

<#layouttest applies to Contact, Group, Lookup, Report, UserPicker, Tasklist, Query, Navbar, NewSale, dbPage, dbList, Library, Personal Library.

 

This function can be used in several different manners. Examples are- Loading different fields based on whether a contact is a prospect or a customer. Making some fields read-only based on the record manager. Controlling what reports are available based on team membership.

The Layout test goes immediately after <head>

  • <#LAYOUTTEST FIELD=x VALUE="field value" file="contact layout file.html" >
    If the value of fieldx is "field value" use the contact layout specified.
  • <#LAYOUTTEST field=Status value="Candidate" FILE=navbar_candidate.html>
    < #LAYOUTTEST field=Status value="Supplier" FILE=navbar.html>
    < #LAYOUTTEST field=Status value="Client" FILE=navbar.html>
    The above example would allow you to bring in more tabs if needed per record type
  • <#LAYOUTTEST recordmanager=yes file="contact layout file.html" >
    If the current user is the record manager of the current record use the contact layout specified.
  • <#LAYOUTTEST recordmanager=no file="contact layout file.html" >
    If the current user is not the record manager of the current record use the contact layout specified.
  • <#LAYOUTTEST team=teamname file="contact layout file.html" >
    If the current user is a member of the team specified use the contact layout specified.
  • <#LAYOUTTEST user="Chris Huffman" file="contact layout file.html" >
    If the current user is the "Chris Huffman" use the contact layout specified.
  • <#LAYOUTTEST profile=security1 file="contact layout file.html" >
    If the current user is assigned the security profile security1 use the contact layout specified.
  • <#LAYOUTTEST recordmanager=yes FIELD=x VALUE="field value" file="contact layout file.html" >
    If the current user is the record manager of the current record and the value of field X is "field value", use the contact layout specified.
  • <#LAYOUTTEST recordmanager=no user="Chris Huffman" file="contact layout file.html" >
    If the current user is not the record manager of the current record and the current user is "Chris Huffman" use the contact layout specified.

You only need to use the <#LAYOUTTESTtags in the primary template for a contact, group or navigation bar. You don't need them in each of your templates (having <#LAYOUTTESTtags in all of your templates may lead to infinite loop conditions). The first test that matches will switch the layouts. You may have several tests in a single template.

EXAMPLE:

<#LAYOUTTEST FIELD=x VALUE="field value" file="contact layout file.html" >
where x is the field number of the field you want to test with (ID/Status would be field 34) and "field value" would be the value of the field where you would want the template to change, and the "contact layout file.html" would be the new template. So, for example, if ID Status was Customer and you wanted to switch to the Customer.html contact layout when ever the ID/Status field was customer, you would use:
<#LAYOUTTEST FIELD=34 VALUE="Customer" file="customer.html" >
in the contact.html file. If you had another layout for prospect, you would add:

<#LAYOUTTEST FIELD=34 VALUE="Prospect" file="contact_prospect.html" >
after the first LayoutTest tag. You can have as many layouttest tags as you need. You would need to create the additional contact templates - WiredContact does not ship with a Customer.html or a contact_prospect.html file.

Add Feedback