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".

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
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)
<number>

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.
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 1 sample items (as these records have data viewing enabled) but is otherwise the default structure you will get from this Component.

{
  "items": [
  {
    "Id": 17,
    "Email": "alextest@test.com",
    "FirstName": "Alex",
    "LastName": "Smith",
    "Address": "",
    "City": "",
    "State": "",
    "ZipCode": "",
    "Country": "",
    "Site": "",
    "Phone": "",
    "Status": "",
    "Notes": "",
    "Type": "Wholesaler",
    "CreatedDateTime": "2019-06-12T23:28:59.07",
    "UpdatedDateTime": "2020-08-07T12:56:27.713"
  }
],
  "Params": {}
}

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

Accessing the Data

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

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


Related Articles

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.