Using CRM Query Language

On this page

Overview

CRMQL stands for CRM.COM Query Language and was developed by CRM.COM for querying information within the system. CRMQL supports specific types of queries which depend on the entity selected in each segment.

CRMQL Syntax

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

The values of criteria depend on the type of criteria and operator.

Global functions can be used instead of the set of criteria, operators and values.

CRMQL Syntax
(criteria_name operator criteria_value|global_function) ((AND|OR) (criteria_name operator criteria_value|global_function))* 

CRMQL Functions

Global Functions

FunctionParametersResultDescription
only_one(query)CRMQL queryBooleanReturns true if the specified query retrieves only one record; otherwise returns false.
more_than_one(query)CRMQL queryBooleanReturns true if the specified query retrieves more than one record; otherwise returns false.

Date Functions

FunctionParametersResultDescription
week_start()noneDateReturns the start of the week.
month_start()noneDateReturns the start of the month.
year_start()noneDateReturns the start of the year.
day_start()noneDate

Returns the start of the day having the time set to 00:00:00.

day_end()noneDateReturns the end of the day having the time set to 23:59:59.
current_date()noneDateReturns the current date and time.
week_end()noneDateReturns the end of the week.
month_end()noneDateReturns the end of the month.
year_end()noneDateReturns the end of the year.
seconds_before(date,seconds)Date, NumberDateReturns the date which is before the specified number of seconds.
minutes_before(date,minutes)Date, NumberDateReturns the date which is before the specified number of minutes.
hours_before(date,hours)Date, NumberDateReturns the date which is before the specified number of hours.
days_before(date,days)Date, NumberDateReturns the date which is before the specified number of days.
weeks_before(date,weeks)Date, NumberDateReturns the date which is before the specified number of weeks.
months_before(date,months)Date, NumberDateReturns the date which is before the specified number of months.
years_before(date,years)Date, NumberDateReturns the date which is before the specified number of years.
seconds_after(date,seconds)Date, NumberDateReturns the date which is after the specified number of seconds.
minutes_after(date,minutes)Date, NumberDateReturns the date which is after the specified number of minutes.
hours_after(date,hours)Date, NumberDateReturns the date which is after the specified number of hours.
days_after(date,days)Date, NumberDateReturns the date which is after the specified number of days.
weeks_after(date,weeks)Date, NumberDateReturns the date which is after the specified number of weeks.
months_after(date,months)Date, NumberDateReturns the date which is after the specified number of months.
years_after(date,years)Date, NumberDateReturns the date which is after the specified number of days.
date_only(date)DateDate Only (time set to 00:00:00)Returns the specified date having the time set to 00:00:00.
current_day()noneIntegerReturns the current day's value (1-31).
current_month()noneIntegerReturns the current month's value (1-12).
current_year()noneIntegerReturns the current year's value ().

CRMQL Operators & Possible Values

Global Operators

Global operators are used to check whether a specific value is present within a set of values.

FunctionParametersResultDescription
exist(query)CRMQL queryBooleanReturns true if the specified query retrieves one or more records; otherwise returns false.
not exist(query)CRMQL queryBooleanReturns true if the specified query retrieves zero records, otherwise returns false.

Using Global Operator with Set Data Object

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

Global 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
udf_string_1 - udf_string_16String
udf_float_1 - udf_float_8Float
udf_date_1 - udf_date_8Date
address

Set Data Object

phoneSet Data Object
emailSet Data Object
accounts_receivableSet Data Object
activitySet Data Object
 contact_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

udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date

phone

Field

Type

type

String

area_code

String

full_number

String

udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date

email

Field

Type

type

String

email

String

udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date

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
applied_processSet Data Object
udf_string_1 - udf_string_8String
udf_float_1 - udf_float_8Float
udf_date_1 - udf_date_8Date
 subscription reference data objects

accounts_receivable

FieldType
numberString
nameString
life_cycle_stateString
balanceNumber
outstanding_amountNumber

classification

(name)

String
credit_limit_statusString
primary_accountBoolean
udf_string_1 - udf_string_8String
udf_float_1 - udf_float_8Float
udf_date_1 - udf_date_8Date


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

effective_date

 Date

udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date

subscription_location

Field

Type

type

String

postal_code

String

street_name

String

area

String

town

String

district

String

municipality

String

country

String

udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date

billing_address

Field

Type

type

String

postal_code

String

street_name

String

area

String

town

String

district

String

municipality

String

country

String

udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date

owned_by_group

Field
Type
alternative_codeString
nameString
numberString


service

Field

Type

product

(code)

Single Data Object

life_cycle_state

String

life_cycle_state_start_date

Date

date_added

Date

date_removed

Date

rated_up_to_dateDate
udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date
 service reference data objects

product

Field

Type

type

 String


installed_item

Field

Type

serial_number

String

product

(code)

Single Data Object

date_added

Date

date_removed

Date

udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date
 installed_item reference data objects

product

Field

Type

type

 String

applied_process

Field

Type

name

String

applied_date

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
wallet

Single Data Object

Note: Only refers to 'Effective' wallets

parent_account

Single Data Object


presentment_preference

Set Data Object


assets


Set Data Object


udf_string_1 - udf_string_8String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date
 accounts_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
udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date
 contact_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

udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date

phone

Field

Type

type

String

area_code

String

full_number

String

udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date

email

Field

Type

type

String

email

String

udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date

subscription

FieldType

type

(name)

String
life_cycle_stateString
numberString
billing_termsSingle Data Object
subscription_locationSingle Data Object
serviceDynamic Data Object
installed_itemDynamic Data Object
applied_processSet Data Object
udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date


 subscription 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

udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date

subscription_location

Field

Type

type

String

postal_code

String

street_name

String

area

String

town

String

district

String

municipality

String

country

String

udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date

service

Field

Type

product

(code)

Single Data Object

life_cycle_state

String

life_cycle_state_start_date

Date

date_added

Date

date_removed

Date

udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date
 service reference data objects

product

Field

Type

type

 String


installed_item

Field

Type

serial_number

String

product

(code)

Single Data Object

date_added

Date

date_removed

Date

udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date
 installed_item reference data objects

product

Field

Type

type

 String

applied_process

Field

Type

name

String

applied_date

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
udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date


billing_address

Field

Type

type

String

postal_code

String

street_name

String

area

String

town

String

district

String

municipality

String

country

String

udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date

presentment_preference

FieldType
presentment_methodString

active

Boolean

wallet

This information only refers to 'Effective' wallets.

FieldType
numberNumber

balance

Number
estimated_consumption_daysNumber
estimated_consumption_dateNumber
udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date

assets

FieldType

product

(code)

Single Data Object


 assets reference data objects

product

Field

Type

type

 String

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
udf_string_1 - udf_string_8String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date
 bill reference data objects

accounts_receivable

FieldType
numberString
nameString
life_cycle_stateString
balanceNumber
outstanding_amountNumber

classification

(name)

String
credit_limit_statusString
primary_accountBoolean
udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date

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
udf_string_1 - udf_string_16String
udf_float_1 - udf_float_10Float
udf_date_1 - udf_date_10Date
 activity 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
udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date


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
subscription

Single Data Object


start_dateDate
estimated_completion_dateDate
actual_completion_dateDate
expiration_date

Date


physical_goodSet Data Object
expenseSet Data Object
subscription_physical_good

Set Data Object


subscription_service

Set Data Object


subscription_expense

Set Data Object


billing_termsSet Data Object
udf_string_1 - udf_string_16String
udf_float_1 - udf_float_8Float
udf_date_1 - udf_date_8Date



 job reference data objects

accounts_receivable

FieldType
numberString
nameString
life_cycle_stateString
balanceNumber
outstanding_amountNumber

classification

(name)

String
credit_limit_statusString
primary_accountBoolean
udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date

physical_good

FieldType

product

(code)

Single Data Object
date_addedDate
 physical_good reference data objects

product

Field

Type

type

 String


expense

FieldType
serial_numberString

product

(code)

String
date_addedDate


subscription_physical_good

FieldType

product

(code)

Single Data Object
date_addedDate
 subscription_physical_good reference data objects

product

Field

Type

type

 String


subscription_service

FieldType

product

(code)

String
date_addedDate


subscription_expense

FieldType

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

life_cycle_state

String
udf_string_1 - udf_string_8String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date
 rewards participant reference data objects

accounts_receivable

FieldType
numberString
nameString
life_cycle_stateString
balanceNumber
outstanding_amountNumber

classification

(name)

String
credit_limit_statusString
primary_accountBoolean

wallet

Single Data Object

Note: Only refers to 'Effective' wallets

udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date
 accounts receivable reference data objects

wallet


This information only refers to 'Effective' wallets.

FieldType
numberNumber

balance

Number
estimated_consumption_daysNumber
estimated_consumption_dateNumber
udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date


participating_reward_scheme

Field

Type

name

String

alternative_code

String

sign_up_date

Date

sign_up_unit

(name)

String

udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date

award_reward_transaction 

FieldType
numberString
rewards_participantSet Data Object
submitted_dateDate

amount

Number
reward_offerSingle Data Object
 award reward transaction reference data objects

rewards_participant

FieldType
numberString
sign_up_dateDate

sign_up_unit

(name)

String
udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date

reward_offer

Field

Type

number

String

name

String

alternative_code

String

scheme

(name)

String

type

(name)

String

udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date

spend_reward_transaction 

FieldType
numberString
rewards_participantSet Data Object

total_amount

Number
submitted_dateDate

submitted_by_unit

(name)

String
 spend reward transaction reference data objects

rewards_participant

FieldType
numberString
sign_up_dateDate

sign_up_unit

(name)

String
udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date

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
udf_string_1 - udf_string_16String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_12Date
 service_request reference data objects

accounts_receivable

FieldType
numberString
nameString
life_cycle_stateString
balanceNumber
outstanding_amountNumber

classification

(name)

String
credit_limit_statusString
primary_accountBoolean
udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date

physical_good

FieldType
serial_numberString

product

(code)

String
date_addedDate
udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date

services

FieldType

product

(code)

String
date_addedDate
udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date

payment_gateway_card


FieldType

payment_gateway_provider

(name)

String
expiration_monthNumber
expiration_yearNumber
brandString
typeString
address_line_1_check_resultString
address_zip_check_resultString
security_code_check_resultString
created_dateDate
updated_dateDate
defaultBoolean

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
udf_string_1 - udf_string_8String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date
 payment reference data objects

accounts_receivable

FieldType
numberString
nameString
life_cycle_stateString
balanceNumber
outstanding_amountNumber

classification

(name)

String
credit_limit_statusString
primary_accountBoolean
udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date

voucher

FieldType

type

(name)

String

lot

(number)

String
valueNumber
life_cycle_stateString
udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date


communication

FieldType
directionString

media

String
categoryString
life_cycle_stateString
created_dateDate
udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date

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 but remains available for backwards compatibility. The logic is updated to work based on rating_state logic.

rating_state

StringReplaces binding_state
life_cycle_stateString
subscriptionSet Data Object
udf_string_1 - udf_string_8String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date
 buy_in_advance_request reference data objects

subscription

Field
Type

type

(name)

String
life_cycle_stateString
numberString
udf_string_1 - udf_string_4String
udf_float_1 - udf_float_4Float
udf_date_1 - udf_date_4Date

CRMQL Autocomplete Enable Fields 

Specific fields of objects (type, status, life cycle state) provide users the ability to select values from a pre-populated list. The list is populated after the operator is provided next to an <object.field> expression.

Type


Object
Field
Entity to be Populated
contact_informationtypeType name
subscriptiontypeType name
activitytypeType name
jobtypeType name
service_requesttypeType name
payment_gateway_cardtypeType name
paymenttypeType name

Status

Object
Field
Entity to be Populated
billstatusStatus name
activitystatusStatus name
jobstatusStatus name
service_requeststatusStatus name

Life Cycle State

Object
Field
Entity to be Populated
contact_informationlife_cycle_stateLife cycle state name
subscriptionlife_cycle_stateLife cycle state name
accounts_receivablelife_cycle_stateLife cycle state name
billlife_cycle_stateLife cycle state name
activitylife_cycle_stateLife cycle state name
joblife_cycle_stateLife cycle state name
rewards_participantlife_cycle_stateLife cycle state name
service_requestlife_cycle_stateLife cycle state name
payment_gateway_requestlife_cycle_stateLife cycle state name
buy_in_advance_requestlife_cycle_stateLife cycle state name