Skip to main content
Skip table of contents

Entering query expressions

The query expressions that you may enter are pieces of Scheme code which are used to test each entity and return a value of true or false.

If the entity satisfies the conditions of the expression, then it is shown in the contact list when you apply the system defined query in the Contacts workspace in NexJ CRM.

The most common kind of query you will use is a simple text search, where you will search a particular property for values matching a specified text string. To do this, enter (= (@<propertyname>) "<searchtext>") into the Query Value field (note that the search text must be enclosed in quotation marks). For example, if you wanted to find all contacts with a first name of 'John', you would enter (= (@ firstName) "John") into the Query Value field. The following is a table of common properties you may want to query for in a simple text search, as well as their property names:

Property names are case sensitive, with more complex properties requiring more than one word to return the desired query results.

Common text searches

PropertyProperty name
first namefirstName
last name (this is also used for the names of companies and households)lastName
first three letters of last namelastNameOneToThree
deardear
goes bygoesBy
default email addressemailAddress
companycompany lastName
departmentdepartment lastName
householdhousehold lastName
default street addressdefaultAddress address1
default citydefaultAddress city

Another kind of query you can do determines if a fact about an entity is true or false. Variables that store true/false values about the entity are called boolean variables. For example, you may want to filter the entities so that only clients or entities with a coverage team are displayed. To do this, you must enter (= (@ <propertyname>) #t) in the Query Value field if you want the property to be true, and (= (@ <propertyname>) #f) if you want the property to be false, where the propertyname is determined by what you are searching for. The following is a table of common properties you may want to query for in a true/false search, as well as their property names:

Common boolean searches

PropertyProperty name
has at least one user covering itisCovered
the searching user is the owner of this entityisMine
has a default emailhasEmail
is a clientisClient
is a prospective clientisProspect
is a former clientisFormerClient
has client status set to OtherisOther
is being tracked by activity tracking systemisActTracking
is part of a householdhasHousehold

Finally, you may want to use the boolean operators andor, and not to further refine your system defined queries:

  • The and operator is followed by two or more different expressions and returns true only if all of them are true. For example, the code (and (= (@ firstName) "John") (= (@ isClient) #t)) would return a list of contacts whose first names are John and are current clients. You can also add more expressions, contained individually in parentheses, to the end of the current expression.
  • The or operator is followed by two or more different expressions and returns true if at least one of them is true. For example, the code (or (= (@ firstName) "John") (= (@ isClient) #t)) would return a list of contacts whose first names are John or are current clients. You can also add more expressions, contained individually in parentheses, to the end of the current expression.
  • The not operator is followed by an expression, and returns the opposite of the expression's value. For example, (not (= (@ firstName) "John")) would return a list of contacts whose first names are not John.

Adding system defined queries
Editing system defined queries

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.