Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt
hiddentrue

Learn how to use CRM Query Language

What does this section cover?

Table of Contents
minLevel2

What is CRM Query Language

CRMQL stands for CRM.COM Query Language, which is business query language developed by CRM.COM in order to be used to query information within the CRM.COM system. CRMQL supports specific type of queries, which depend on the entity selected on the segment (or any other entity that might be using CRMQL Queries).

CRMQL Syntax

The structure of the CRMQL syntax is described below (using regular expressions). In general the CRMQL query consists of at least one set of criteriaoperator and value. More than one sets can be defined or separated using AND or OR.

Criteria values, depend on the type of the specified criteria and the type of the specified operator.

Global functions can be used instead of the set of criteria, operator, value

Panel
nameblue
titleCRMQL Syntax
(criteria_name operator criteria_value|global_function) ((AND|OR) (criteria_name operator criteria_value|global_function))* 

Validations & Restrictions

N/A

CRMQL Functions

Anchor
global
global
Global Functions

FunctionParametersResultDescription
only_one(query)CRMQL queryBooleanIt returns true if the specified query retrieves only one record, otherwise is returns false
more_than_one(query)CRMQL queryBooleanIt returns true if the specified query retrieves more than one records, otherwise is returns false

Date Functions

FunctionParametersResultDescription
week_start()noneDateIt returns the start of the week
month_start()noneDateIt returns the start of the month
year_start()noneDateIt returns the start of the year
day_start()noneDate

It returns the start of the day having the time set to 00:00:00

day_end()noneDateIt returns the end of the day having the time set to 23:59:59
current_date()noneDateIt returns the current date and time
week_end()noneDateIt returns the end of the week
month_end()noneDateIt returns the end of the month
year_end()noneDateIt returns the end of the year
Status
colourRed
titleAvailable from CRM.COM R9.0.0
- seconds_before(date,seconds)
Date, NumberDateIt returns the date which is before the specified number of seconds
Status
colourRed
titleAvailable from CRM.COM R9.0.0
- minutes_before(date,minutes)
Date, NumberDateIt returns the date which is before the specified number of minutes
Status
colourRed
titleAvailable from CRM.COM R9.0.0
- hours_before(date,hours)
Date, NumberDateIt returns the date which is before the specified number of hours
days_before(date,days)Date, NumberDateIt returns the date which is before the specified number of days
weeks_before(date,weeks)Date, NumberDateIt returns the date which is before the specified number of weeks
months_before(date,months)Date, NumberDateIt returns the date which is before the specified number of months
years_before(date,years)Date, NumberDateIt returns the date which is before the specified number of years
Status
colourRed
titleAvailable from CRM.COM R9.0.0
- seconds_after(date,seconds)
Date, NumberDateIt returns the date which is after the specified number of seconds
Status
colourRed
titleAvailable from CRM.COM R9.0.0
- minutes_
after(date,minutes)
Date, NumberDateIt returns the date which is after the specified number of minutes
Status
colourRed
titleAvailable from CRM.COM R9.0.0
- hours_
after(date,hours)
Date, NumberDateIt returns the date which is after the specified number of hours
days_after(date,days)Date, NumberDateIt returns the date which is after the specified number of days
weeks_after(date,weeks)Date, NumberDateIt returns the date which is after the specified number of weeks
months_after(date,months)Date, NumberDateIt returns the date which is after the specified number of months
years_after(date,years)Date, NumberDateIt returns the date which is after the specified number of days
date_only(date)DateDate Only (time set to 00:00:00)It returns the specified date having the time set to 00:00:00
current_day()noneIntegerIt returns the current day's value (1-31)
current_month()noneIntegerIt returns the current month's value (1-12)
current_year()noneIntegerIt returns the current year's value ()

CRMQL Operators & Possible Values

Global Operators

Global Operators are used to check if a value exist or not within a Set of values

FunctionParametersResultDescription
exist(query)CRMQL queryBooleanIt returns true if the specified query retrieves one or more records, otherwise is returns false
not exist(query)CRMQL queryBooleanIt returns true if the specified query retrieves zero records, otherwise is returns false
Info
titleUsing Global Operator with Set Data Object

Global operators must be used when a Set of Data Objects is used:

Code Block
languagesql
titleGlobal operators - Set of Data Object
(criteria_name operator criteria_value|global_function) 
((AND EXIST|OR EXIST| AND NOT EXIST| OR NOT EXIST) (criteria_name operator criteria_value|global_function))* 

 

String Operators

OperatorPossible Values
=value | string field | empty
!=value | string field | empty
<>value | string field | empty
value | string field
>=value | string field
<value | string field
<=value | string field
likevalue
not likevalue
in()(value | string field) ( , (value | string field) )*
not in()(value | string field) ( , (value | string field) )*

Numeric Operators

OperatorPossible Values
=value | numeric field | empty
!=value | numeric field | empty
<>value | numeric field | empty
value | numeric field
>=value | numeric field
<value | numeric field
<=value | numeric field
between X and Yvalue | numeric field

Date Operators

OperatorPossible Values
=value (dd/mm/yyyy) | date field | date function | empty
!=value (dd/mm/yyyy) | date field | date function | empty
<>value (dd/mm/yyyy) | date field | date function | empty
value (dd/mm/yyyy) | date field | date function
>=value (dd/mm/yyyy) | date field | date function
<value (dd/mm/yyyy) | date field | date function
<=

value (dd/mm/yyyy) | date field | date function

between X and Yvalue (dd/mm/yyyy) | date field | date function

Boolean Operators

OperatorPossible Values
=true | false
!=true | false
<>true | false

CRMQL Main Data Objects

contact_information

FieldType
typeString
life_cycle_stateString
nameString
first_nameString
middle_nameString
last_nameString

category

(name)

String
genderString
day_of_birthNumber
month_of_birthNumber
year_of_birthNumber
name_day_dayNumber
name_day_monthNumber

industry

(name)

String

industry_sector

(name)

String
address

Set Data Object

phoneSet Data Object
emailSet Data Object
accounts_receivableSet Data Object
activitySet Data Object
Expand
titlecontact_information reference data objects

address

Field

Type

type

String

postal_code

String

street_name

String

area

String

town

String

district

String

municipality

String

country

String

phone

Field

Type

type

String

area_code

String

full_number

String

email

Field

Type

type

String

email

String

subscription

FieldType

type

(name)

String
life_cycle_stateString
numberString
accounts_receivableSingle Data Object
billing_termsSingle Data Object
subscription_locationSingle Data Object
billing_addressSingle Data Object
serviceSet Data Object
installed_itemSet Data Object
Expand
titlesubscription reference data objects

billing_terms

Field

Type

unified_number

 String

scheme_name

 String

price_plan_name

 String

billing_method

 String

frequency

 String

cycle_day

 Number

binding_period

 String

binding_start_date

 Date

binding_end_date

 Date

agreement_date

 Date

life_cycle_state

 String

effective_date

 Date

expiration_date

 Date

subscription_location

Field

Type

type

String

postal_code

String

street_name

String

area

String

town

String

district

String

municipality

String

country

String

billing_address

Field

Type

type

String

postal_code

String

street_name

String

area

String

town

String

district

String

municipality

String

country

String

service

Field

Type

product

(code)

String

life_cycle_state

String

life_cycle_state_start_date

Date

date_added

Date

date_removed

Date

installed_item

Field

Type

serial_number

String

product

(code)

String

date_added

Date

date_removed

Date

accounts_receivable

FieldType
numberString
nameString
life_cycle_stateString
balanceNumber
outstanding_amountNumber
contact_informationSingle Data Object
subscriptionSet Data Object
billSet Data Object

classification

(name)

String
credit_limit_statusString
primary_accountBoolean
billing_addressSingle Data Object
presentment_preferenceSet Data Object
Expand
titleaccounts_receivable reference data objects

contact_information

FieldType
typeString
life_cycle_stateString
nameString
first_nameString
middle_nameString
last_nameString

category

(name)

String
genderString
day_of_birthNumber
month_of_birthNumber
year_of_birthNumber
name_day_dayNumber
name_day_monthNumber

industry

(name)

String

industry_sector

(name)

String
address

Set Data Object

phoneSet Data Object
emailSet Data Object
Expand
titlecontact_information reference data objects

address

Field

Type

type

String

postal_code

String

street_name

String

area

String

town

String

district

String

municipality

String

country

String

phone

Field

Type

type

String

area_code

String

full_number

String

email

Field

Type

type

String

email

String

subscription

FieldType

type

(name)

String
life_cycle_stateString
numberString
billing_termsSingle Data Object
subscription_locationSingle Data Object
serviceDynamic Data Object
installed_itemDynamic Data Object
Expand
titlesubscription reference data objects

billing_terms

Field

Type

unified_number

 String

scheme_name

 String

price_pan_name

 String

billing_method

 String

frequency

 String

cycle_day

 Number

binding_period

 String

binding_start_date

 Date

binding_end_date

 Date

agreement_date

 Date

effective_date

 Date

subscription_location

Field

Type

type

String

postal_code

String

street_name

String

area

String

town

String

district

String

municipality

String

country

String

service

Field

Type

product

(code)

String

life_cycle_state

String

life_cycle_state_start_date

Date

date_added

Date

date_removed

Date

installed_item

Field

Type

serial_number

String

product

(code)

String

date_added

Date

date_removed

Date

bill

Field
Type
numberString
classificationString
life_cycle_stateString
from_dateDate
to_dateDate
due_dateDate
total_credit_amountNumber
total_debit_amountNumber
total_billed_amountNumber
total_amount_to_be_paidNumber
outstanding_amountNumber
unsettled_amountNumber
statusString

billing_address

Field

Type

type

String

postal_code

String

street_name

String

area

String

town

String

district

String

municipality

String

country

String

presentment_preference

FieldType
presentment_methodString

active

Boolean

bill

FieldType
numberString
accounts_receivableSingle Data Object
classificationString
life_cycle_stateString
from_dateDate
to_dateDate
due_dateDate
total_credit_amountNumber
total_debit_amountNumber
total_billed_amountNumber
total_amount_to_be_paidNumber
outstanding_amountNumber
unsettled_amountNumber
statusString
communication_queueSet Data Object
Expand
titlebill reference data objects

accounts_receivable

FieldType
numberString
nameString
life_cycle_stateString
balanceNumber
outstanding_amountNumber

classification

(name)

String
credit_limit_statusString
primary_accountBoolean

communication_queue

FieldType
external_systemString
life_cycle_stateString
directionString
mediaString
categoryString
created_dateDate
error_codeString

activity

FieldType
numberString

type

(name)

String

status

(name)

String

category

(name)

String
life_cycle_stateString
contact_informationSingle Data Object
start_dateDate
estimated_completion_dateDate
actual_completion_dateDate
serviceSet Data Object
Expand
titleactivity reference data objects

contact_information

FieldType
typeString
life_cycle_stateString
nameString
first_nameString
middle_nameString
last_nameString

category

(name)

String
genderString
day_of_birthNumber
month_of_birthNumber
year_of_birthNumber
name_day_dayNumber
name_day_monthNumber

industry

(name)

String

industry_sector

(name)

String

 

service

FieldType

product

(code)

String
date_addedDate

job

FieldType
numberString

type

(name)

String

status

(name)

String

category

(name)

String
life_cycle_stateString
accounts_receivableSingle Data Object
start_dateDate
estimated_completion_dateDate
actual_completion_dateDate
billing_termsSet Data Object
physical_goodSet Data Object
expenseSet Data Object
Expand
titlejob reference data objects

accounts_receivable

FieldType
numberString
nameString
life_cycle_stateString
balanceNumber
outstanding_amountNumber

classification

(name)

String
credit_limit_statusString
primary_accountBoolean

physical_good

FieldType

product

(code)

String
date_addedDate

expense

FieldType
serial_numberString

product

(code)

String
date_addedDate

billing_terms

FieldType
unified_number String
scheme_name String
price_pan_name String
agreement_date Date
effective_date Date
expiration_date Date

rewards_participant 

 

FieldType
numberString
accounts_receivableSingle Data Object
sign_up_dateDate

sign_up_unit

(name)

String
participating_reward_schemeSet Data Object
Expand
titlerewards participant reference data objects

accounts_receivable

FieldType
numberString
nameString
life_cycle_stateString
balanceNumber
outstanding_amountNumber

classification

(name)

String
credit_limit_statusString
primary_accountBoolean

participating_reward_scheme

Field

Type

name

String

alternative_code

String

sign_up_date

Date

sign_up_unit

(name)

String

award_reward_transaction 

 

FieldType
numberString
rewards_participantSet Data Object
submitted_dateDate

amount

Number
reward_offerSingle Data Object
Expand
titleaward reward transaction reference data objects

rewards_participant

FieldType
numberString
sign_up_dateDate

sign_up_unit

(name)

String

reward_offer

Field

Type

number

String

name

String

alternative_code

String

scheme

(name)

String

type

(name)

String

spend_reward_transaction 

 

FieldType
numberString
rewards_participantSet Data Object

total_amount

Number
submitted_dateDate

submitted_by_unit

(name)

String
Expand
titlespend reward transaction reference data objects

rewards_participant

FieldType
numberString
sign_up_dateDate

sign_up_unit

(name)

String

service_request

 

FieldType
numberString

type

(name)

String

status

(name)

String

category

(name)

String

classification

(name)

String
life_cycle_stateString
accounts_receivableSingle Data Object
urgency_levelString
impact_levelString
priority_levelString
start_dateDate
estimated_completion_dateDate
actual_completion_dateDate
response_dateDate
response_categoryString
temporary_resolution_categoryString
temporary_resolved_byString
temporary_resolution_dateDate
temporary_resolution_accepted_byString
final_resolution_categoryString
final_resolution_resolved_byString
final_resolution_accepted_byString
final_resolution_dateDate
physical_goodSet Data Object
servicesSet Data Object
Expand
titleservice_request reference data objects

accounts_receivable

FieldType
numberString
nameString
life_cycle_stateString
balanceNumber
outstanding_amountNumber

classification

(name)

String
credit_limit_statusString
primary_accountBoolean

physical_good

FieldType
serial_numberString

product

(code)

String
date_addedDate

services

FieldType

product

(code)

String
date_addedDate

payment_gateway_card

 

FieldType

payment_gateway_provider

(name)

String
expiration_monthNumber
expiration_dateNumber
brandString
typeString
address_line_1_check_resultString
address_zip_check_resultString
security_code_check_resultString
created_dateDate
updated_dateDate
defaultBoolean
Info

Note that only the cards which are related with an accounts receivable payment preference which is used for recurring payments are retrieved. 

payment_gateway_request

 

FieldType

payment_gateway_provider

(name)

String
life_cycle_stateString

process_run

(number)

String
created_dateDate

payment

 

FieldType
numberString
reference_numberString

type

(name)

String

payment_method

(name)

String

category

(name)

String
posted_dateDate
amountNumber
accounts_receivableSingle Data Object
voucherSingle Data Object
communicationSet Data Object
Expand
titlepayment reference data objects

accounts_receivable

FieldType
numberString
nameString
life_cycle_stateString
balanceNumber
outstanding_amountNumber

classification

(name)

String
credit_limit_statusString
primary_accountBoolean

voucher

FieldType

type

(name)

String

lot

(number)

String
valueNumber
life_cycle_stateString

communication

FieldType
directionString

media

String
categoryString
life_cycle_stateString
created_dateDate
Info

Note that only posted payments are retrieved

buy_in_advance_request

FieldTypeAdditional information
numberString 
durationNumber 
duration_unit_of_time

String

Supported values are DAYS, WEEKS, MONTHS, YEARS

 
created_dateDate 
billing_effective_dateDate 
expiration_dateDate 
billing_state

String

 

As from CRM.COM R9.0.0 billing_state is replaced by rating_state however it remains available for backward compatibility. The logic however is updated and works based on rating_state logic

rating_state

Status
colourRed
titleAvailable from CRM.COM R9.0.0

StringReplaces binding_state
life_cycle_stateString 
subscriptionSet Data Object 
Expand
titlebuy_in_advance_request reference data objects

subscription

Field
Type

type

(name)

String
life_cycle_stateString
numberString
Note

Visit Understanding Segmentation for business examples related to CRM Query Language

Panel
namegrey

Related Areas

Filter by label (Content by label)
showLabelsfalse
spacesV4Manual
showSpacefalse
excerpttrue
labelssegmentation-basics-r7,segmentation-advanced-r7,segmentation-admin-r7

Panel
namegrey

Popular Labels

Popular Labels
spaceKeyV4Manual
styleheatmap