Change log

CRM Contacts

This component fetches CRM Record data to use on the front-end via Liquid.

{% component type: "CRMContacts" %}

Due to GDPR and privacy regulations CRM contact records will only be output by this component if the "Allow listing my contact data in the CMS" option has been enabled in the users CRM record. This option can only be checked by the user during the submission of the "Update Account Form" or a web Form with the "Allow listing my contact data in the CMS" field added to it.

Parameters and Options

Parameter
Values
Required
Description
type
CRMContacts

This is the name of the entity that needs to be used for the component retrieving function.

layout
<path/to/layout>

Path to file that will contain the Liquid layout content to be parsed.

If an empty string, nothing will be rendered.
If paramater is not included, the default virtual layout will be rendered (see below).

filterBy
Id
Email
FirstName
LastName
...and any other properties available for the module

The name of the property to filter by. If empty or not present, no filtering will be used.

Remove spaces from custom property names here.

filterValue
<your value>

Your specific value to filter by, eg: name, id, number, date, etc.
Liquid variables can be used here also. If present but no value set, no items will be returned.
sortBy
Id
Email
FirstName (default)
LastName
...and any other properties available for the module

The name of the property to sort by. If empty or not present, alpha/numeric sorting will be used.

Remove spaces from custom property names here.

sortOrder
ASC (default)
DESC

ASC sorts the items in ascending order while DESC sorts in descending order (based on alpha/numeric or date sorting).
If empty or not present, alpha/numeric sorting will be used.
limit
10 (default)
<integer>

The maximum number of items returned. If displayPagination is enabled this determines the maximum number of items per page.
offset
0 (default)
<number>

The number of items skipped before being listed.
includeSecureZonesInfo
false (default)
true

When true, fills 'SecureZones' list. If false, or the parameter is not included 'SecureZones' list remains to be empty.

collectionVariable
<yourLiquidVariableName>

Assigns the data to a Liquid collection enabling further access to the data on the Page or Template using Liquid.

Your collectionVariable value must only contain English letters, numbers or underscores. Spaces or special characters are not supported.

Liquid Output

The below example has 2 sample items (as these records have data viewing enabled) but is otherwise the default structure you will get from this Component (with includeSecureZonesInfo added and set to true).

{
  "Items": [
    {
      "Id": 1442,
      "Email": "alextest@test.com",
      "FirstName": "Alex",
      "LastName": "Smith",
      "Address": null,
      "City": null,
      "State": null,
      "ZipCode": null,
      "Country": null,
      "BillingAddress": null,
      "BillingCity": null,
      "BillingState": null,
      "BillingZipCode": null,
      "BillingCountry": null,
      "Site": null,
      "Phone": "123456789",
      "Status": null,
      "Notes": null,
      "Type": "Consumer",
      "IsDataUsingAllowed": true,
      "CreatedDateTime": "2019-06-12T17:28:59.07",
      "UpdatedDateTime": "2024-01-13T05:16:30.428091",
      "CrmType": "Member",
      "IsEmailVerified": true,
      "Role": "General",
      "SecureZones": [
        {
          "id": "2221",
          "name": "Members Only",
          "landingpageid": 2225,
          "createddatetime": "2020-08-07T06:51:47.99",
          "expirydatetime": "9999-12-31T00:00:00",
          "updateddatetime": "2020-08-07T06:51:47.99"
        }
      ],
      "RecurringSubscriptions": []
    },
    {
      "Id": 1430,
      "Email": "joetest@test.com",
      "FirstName": "Joe",
      "LastName": "Test",
      "Address": "1 Street St",
      "City": "Streetville",
      "State": "NSW",
      "ZipCode": "2000",
      "Country": "Australia",
      "BillingAddress": "1 Street St",
      "BillingCity": "Streetville",
      "BillingState": "NSW",
      "BillingZipCode": "2000",
      "BillingCountry": "US",
      "Site": null,
      "Phone": "12340987",
      "Status": null,
      "Notes": null,
      "Type": "Consumer",
      "IsDataUsingAllowed": true,
      "CreatedDateTime": "2021-07-04T22:39:50.346055",
      "UpdatedDateTime": "2024-01-13T05:15:50.738335",
      "CrmType": "Member",
      "IsEmailVerified": true,
      "Role": "General",
      "SecureZones": [
        {
          "id": "2221",
          "name": "Members Only",
          "landingpageid": 2225,
          "createddatetime": "2020-08-07T06:20:31.48",
          "expirydatetime": "9999-12-31T00:00:00",
          "updateddatetime": "2020-08-07T06:20:31.48"
        }
      ],
      "RecurringSubscriptions": []
    }
  ],
  "Params": {
    "type": "CRMContacts",
    "collectionvariable": "enabledContacts",
    "layout": "",
    "includesecurezonesinfo": "true"
  }
}

Virtual Layout

Based on the above example, if not using any custom layout or collection, the default virtual layout will output as a summary list of Contact, eg:

<ul>
    {% for contact in this.items %}
        <li>{{contact.FirstName}} {{contact.LastName}} - {{contact.Email}}</li>
    {% endfor %}
</ul>

Rendering the list:

  • Alex Smith - alextest@test.com
  • Joe Test - joetest@test.com

Accessing the Data

JSON Output

You can output the full JSON for your component data by referencing the root Liquid object {{this}} in your module’s layouts, or directly on your page, if using the collectionVariable parameter in your component tag.

For example:

{% component type: ... collectionVariable: "myData" %}

You can then render the JSON like so:

{{myData}}

For more details on using this approach, see Part 2 of the free ‘Learning Liquid Course’.

Rendering Property Values

This data is also accessible directly on the Page or Template via a Liquid Collection by adding collectionVariable to the Component.

An example using collectionVariable with value "enabledContacts":

{% component type: "CRMContacts", collectionVariable: "enabledContacts" %}

Accessing a specific item within the collection. In this case the second item (zero based index), which in our example would render the value Test

{{enabledContacts.items[1]['lastname']}}


Related Articles

  • CRM
    Contacts

    Contacts store individual’s contact details and other customer-specific data (including extended custom fields) that is either collected via the website, manually added via the admin, or created via external API connections.
  • OpenAPI (Admin)
    CRM Contacts API

    Create, Retrieve, Update and Delete CRM Contacts via the public API endpoint using "where" filtering as well as retrieve a contact's Bookings, Cases and Orders. The contact's Secure Zone details can also be retrieved and password reset via this API.
  • Reports
    Custom Reports

    Custom reports can be used to bring CRM data together, as a spreadsheet, based on your requirements.
  • OpenAPI (Admin)
    Customer Types API

    Retrieve Customer Types via the public API endpoint.
  • CRM
    Form Submissions

    Form Submissions store the captured data from any form submission made on your website (from a form created under ‘Content’ > ‘Forms’).
  • CRM
    Event Bookings

    Event Bookings store all registrations made to an Event item, either via the website front-end or manually allocated via the admin.
  • CRM
    Orders

    Orders store accounts of any payments made via the website and provide management for additional payments, invoices, order statuses, tracking info, the products purchased within the order and the details of the form submission used to take the order.
  • CRM
    Advanced CRM Groups

    Advanced CRM Groups allow you to extend the data fields within multiple areas of the CRM, either globally or on a per-record basis.
  • Liquid Components
    CRMCustomGroup

    This component fetches Advanced CRM Group data attached to CRM Records, Cases, Orders or Event Bookings.
  • Liquid Components
    member_update_form

    This component renders a contact update form for a specified CRM contact so that a CRM Admin role, who is logged in to the front-end, can update the specified contact’s CRM info or secure zone subscriptions.

External Resources

There are currently no external resources available.

Please let us know if you have any other contributions or know of any helpful resources you'd like to see added here.


Questions?

We are always happy to help with any questions you may have.
Visit the Treepl Forum for community support and to search previously asked questions or send us a message at support@treepl.co and we will consult you as soon as possible.