Change log

cases

This component fetches Cases from the CRM, either owned by the logged-in user or for all customer Cases.

{% component type: "cases" %}

Parameters and Options

Parameter
Values
Required
Description
type
cases

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

viewType
list (default)
detail

Outputs a subset of data when viewType is `list` and more data related to the item when set to `detail`. This is to help with performance when listing many items and where not all data is required for output.
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).

currentMemberOnly
true (default)
false

By default (true) retrieves Cases from the logged in user only. If false retrieves Cases for all CRM contacts.
filterBy
Id
FormId
MemberId
FormName
DateSubmission

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.
filterCondition
equally (default)
less
more
lessequally
moreequaly
contains

The condition in which to filter by. For example filtering Case from, and including, a specific date you could filterBy DateSubmission with a filterValue of date 2020-03-02 and a filterCondition moreEqually.

sortBy
Id
FormId
MemberId
FormName
DateSubmission (default)

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
DESC (default)

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.
object
item
collection (default)

Determines the method for Liquid rendering.
item returns each item iteratively, one after another, for output (generally, output to a container element with no need for looping through the data).
collection returns all items as one collection for output (your container element and looping logic would be handled in the Components Layout).
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 (due to a filter applied) but is otherwise the default structure you will get from this Component.

ViewType: List

{
  "Items": [
    {
      "FormName": "DEMO AJAX Example reCaptcha v3",
      "DateSubmission": "2021-08-24T20:20:20.618268",
      "CreatedDateTime": "2021-08-24T20:20:20.618268",
      "Id": "4598",
      "Fields": [
        {
          "Name": "First Name",
          "Alias": "FirstName",
          "Type": "String",
          "Value": "Alex",
          "ArrayValue": [
            "Alex"
          ]
        },
        {
          "Name": "Last Name",
          "Alias": "LastName",
          "Type": "String",
          "Value": "Smith",
          "ArrayValue": [
            "Smith"
          ]
        },
        {
          "Name": "Email",
          "Alias": "Email",
          "Type": "String",
          "Value": "alextest@test.com",
          "ArrayValue": [
            "alextest@test.com"
          ]
        },
        {
          "Name": "Not Required",
          "Alias": "NotRequired",
          "Type": "String",
          "Value": null,
          "ArrayValue": [
            null
          ]
        }
      ],
      "FormId": "1387",
      "OrderId": "0",
      "MemberId": "1442"
    },
    {
      "FormName": "DEMO Contact Form",
      "DateSubmission": "2021-08-24T20:19:56.537341",
      "CreatedDateTime": "2021-08-24T20:19:56.537341",
      "Id": "4587",
      "Fields": [
        {
          "Name": "First Name",
          "Alias": "FirstName",
          "Type": "String",
          "Value": "Alex",
          "ArrayValue": [
            "Alex"
          ]
        },
        {
          "Name": "Last Name",
          "Alias": "LastName",
          "Type": "String",
          "Value": "Smith",
          "ArrayValue": [
            "Smith"
          ]
        },
        {
          "Name": "Email",
          "Alias": "Email",
          "Type": "String",
          "Value": "alextest@test.com",
          "ArrayValue": [
            "alextest@test.com"
          ]
        },
        {
          "Name": "Phone",
          "Alias": "Phone",
          "Type": "String",
          "Value": "123456789",
          "ArrayValue": [
            "123456789"
          ]
        },
        {
          "Name": "Enquiry",
          "Alias": "Enquiry",
          "Type": "Multiline",
          "Value": "Interested in website management.",
          "ArrayValue": [
            "Interested in website management."
          ]
        }
      ],
      "FormId": "1384",
      "OrderId": "0",
      "MemberId": "1442"
    }
  ],
  "Params": {
    "type": "cases",
    "collectionvariable": "allCases",
    "layout": "",
    "filterby": "MemberId",
    "filtervalue": "1442",
    "limit": "3",
    "viewtype": "list"
  }
}

ViewType: Detail

{
  "Items": [
    {
      "FormName": "DEMO AJAX Example reCaptcha v3",
      "DateSubmission": "2021-08-24T20:20:20.618268",
      "CreatedDateTime": "2021-08-24T20:20:20.618268",
      "Id": "4598",
      "Fields": [
        {
          "Name": "First Name",
          "Alias": "FirstName",
          "Type": "String",
          "Value": "Alex",
          "ArrayValue": [
            "Alex"
          ]
        },
        {
          "Name": "Last Name",
          "Alias": "LastName",
          "Type": "String",
          "Value": "Smith",
          "ArrayValue": [
            "Smith"
          ]
        },
        {
          "Name": "Email",
          "Alias": "Email",
          "Type": "String",
          "Value": "alextest@test.com",
          "ArrayValue": [
            "alextest@test.com"
          ]
        },
        {
          "Name": "Not Required",
          "Alias": "NotRequired",
          "Type": "String",
          "Value": null,
          "ArrayValue": [
            null
          ]
        }
      ],
      "FormId": "1387",
      "OrderId": "0",
      "MemberId": "1442"
    },
    {
      "FormName": "DEMO Contact Form",
      "DateSubmission": "2021-08-24T20:19:56.537341",
      "CreatedDateTime": "2021-08-24T20:19:56.537341",
      "Id": "4587",
      "Fields": [
        {
          "Name": "First Name",
          "Alias": "FirstName",
          "Type": "String",
          "Value": "Alex",
          "ArrayValue": [
            "Alex"
          ]
        },
        {
          "Name": "Last Name",
          "Alias": "LastName",
          "Type": "String",
          "Value": "Smith",
          "ArrayValue": [
            "Smith"
          ]
        },
        {
          "Name": "Email",
          "Alias": "Email",
          "Type": "String",
          "Value": "alextest@test.com",
          "ArrayValue": [
            "alextest@test.com"
          ]
        },
        {
          "Name": "Phone",
          "Alias": "Phone",
          "Type": "String",
          "Value": "123456789",
          "ArrayValue": [
            "123456789"
          ]
        },
        {
          "Name": "Enquiry",
          "Alias": "Enquiry",
          "Type": "Multiline",
          "Value": "Interested in website management.",
          "ArrayValue": [
            "Interested in website management."
          ]
        }
      ],
      "FormId": "1384",
      "OrderId": "0",
      "MemberId": "1442"
    }
  ],
  "Params": {
    "type": "cases",
    "collectionvariable": "allCasesDetail",
    "layout": "",
    "filterby": "MemberId",
    "filtervalue": "1442",
    "limit": "3",
    "viewtype": "detail"
  }
}

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 Cases, eg:

<ul>
    {% for item in this.items %}
        <li> 
            <strong>{{item.formName}}</strong>        
            <span>Date Submission: {{item.dateSubmission | format_date: "dddd, MMMM dd, yyyy"}}</span>
        </li>
    {% endfor %}
</ul>

Rendering the list:

  • DEMO AJAX Example reCaptcha v3 Date Submission: Tuesday, August 24, 2021
  • DEMO Contact Form Date Submission: Tuesday, August 24, 2021

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 "allCases":

{% component type: "cases", collectionVariable: "allCases" %}

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

{{allCases.items[2]['formName']}}


Related Articles

  • Custom Reports
    Custom reports can be used to bring CRM data together, as a spreadsheet, based on your requirements.
  • Form Submissions
    Form Submissions store the captured data from any form submission made on your website (from a form created under ‘Content’ > ‘Forms’).
  • 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.
  • {{ workflow }} object
    This liquid object will output the Workflow details of a submitted Form. You can use...
  • orders
    This component fetches Orders from the CRM, either owned by the logged-in user or for all customer Orders.
  • CRMCustomGroup
    This component fetches Advanced CRM Group data attached to CRM Records, Cases, Orders or Event Bookings.

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.