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
CRMContacts
This is the name of the entity that needs to be used for the component retrieving function.
<path/to/layout>
If an empty string, nothing will be rendered.
If paramater is not included, the default virtual layout will be rendered (see below).
Id
Email
FirstName
LastName
...and any other properties available for the module
Remove spaces from custom property names here.
<your value>
Liquid variables can be used here also. If present but no value set, no items will be returned.
Id
Email
FirstName (default)
LastName
...and any other properties available for the module
Remove spaces from custom property names here.
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.
10 (default)
<integer>
0 (default)
<number>
false (default)
true
When true
, fills 'SecureZones' list. If false
, or the parameter is not included 'SecureZones' list remains to be empty.
<yourLiquidVariableName>
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']}}