$Domain.ListCases

Overview

Returns list of cases on specified channel.

DataTable $Domain.ListCases(channelId: string, query: string, start: number, length: number, columns: string, orderBy: string, order: string)

Arguments

string channelId

Id number of channel. Optional. If not specified search is performed in all channels.

string query

Query to execute on cases.

number start

Start number of results. Default is 0.

number length

Maximum length of results. Default is 100

string columns

Comma separated column names to include in result. If not specified all columns are returned.

string orderBy

of list result

string order

type of list result

Returns

Instance of DataTable that contains case list.

Remarks

Query syntax is based full text engine query language.

Example

Search for word "foo" in the Subject field.

``` Subject:foo

Example

Search for phrase "foo bar" in the title field.

``` Subject:"foo bar"

Example

Search for phrase "foo bar" in the Subject field AND the 123 value in Number field.

``` Subject:"foo bar" and Number:123 ```` @example Search for all cases in closed at date range.

ClosedAt:[2020-01-01 TO 2021-01-01]

js var channelId = settings[0].Evaluate('ChannelId'); var columns = ["Id", "Subject", "Number", "CreatedAt", "CreatedBy", "CreatedByName", "UpdatedAt", "ClosedAt", "IsClosed", "TotalTimeSpent", "Priority"].join(','); var query = "IsClosed:'False' OR ClosedAt:[" + $Xml.EvaluateDateTime('Start').toJSON() + " TO " + $Xml.EvaluateDateTime('End').toJSON() + "]"; var cases = $Domain.ListCases(channelId, query, 0, 1000, columns); console.log('found ' + cases.RowCount() + ' case'); ```

Copyright © 2010 - 2023 Emakin. All rights reserved.