Phone type documentation.

Overview

This type can store a phone number, for example 111-222-3333. You could also store an international phone number if you want. In both cases characters other than numbers are stripped out and the phone number is formatted when it is read and displayed on the UI.

Available features

Name Supported Notes

Many multiplicity

yes

Default values

yes

Unique flag

yes

Required flag

yes

Indexable flag

yes

Sensitive flag

yes

Calculated value

yes

Automatic initialization

no

Calculated initial value

no

Aggregation

no

Default type rules

yes

Default display options

no

Type rules

International

Indicates if the field supports international phone number. In this case validation will be a lot more flexible and you will be able to enter international phone numbers.

Default international prefix

If field is set as international and + sign is not indicated at the beginning of the value, then add a default prefix automatically.

Display options

REST API

Read format

The format is a simple string, which will be already formatted as a phone number:

"contactInformation": {
  "phoneNumber": "1-702-845-9380"
}

Write format

You should pass a string with the value:

"contactInformation": {
  "phoneNumber": "1-702-845-9380"
}

You could also pass it without format:

"contactInformation": {
  "phoneNumber": "17028459380"
}

Javascript API

Read format

The val() method in the wrapper will return a the formatted phone number (with dashes):

// this will print something like "phone number: 1-405-298-5885"
log('phone: '+record.field('contactInformation.phoneNumber').val());

Write format

You can pass the phone number in different ways, just keep in mind that only numbers are kept and other characters will be discarded. Then the phone number will be formatted when reading it. Here are some samples:

// all this lines are equivalent
record.field('contactInformation.phone').val('1-405-298-5885');
record.field('contactInformation.phone').val('+1-405-298-5885');
record.field('contactInformation.phone').val('14052985885');

Wrapper

format()

Returns the phone number formatted with dashes.

Returns

string - The formatted phone number.

Samples

// logs the formatted phone number

var record = sys.data.findOne('contacts', {number: 1});
sys.logs.info(record.field('phoneNumber').format());

Export/Import

Export format

The export format is a string with the phone number (including dashes):

"phoneField1","phoneField2"
"111-222-3333","549-261-654-9862"

Import format

The import format is a string with the phone number (dashes are optional):

"phoneField1","phoneField2"
"111-222-3333","549-261-654-9862"

Queries

Please check the documentation for Query language for more information.

Available operators

Operator Supported Notes

equals

yes

notEquals

yes

empty

yes

notEmpty

yes

like

yes

greater

yes

greaterOrEquals

yes

less

yes

lessOrEquals

yes

between

yes

currentUserField

no

Query formats

You should pass the phone number as a plain string. Keep in mind that non-number will be stripped out before running the query. For example:

// finds companies with contact phone number like '123'
var records = sys.data.find('companies', {'contactInformation.phoneNumber': 'like(123)'});
log('total: '+records.count());
while (records.hasNext()) {
  log(records.next().label());
}
// finds companies with contact phone number like '123'
var query = sys.data.createQuery('companies')
    .field('contactInformation.phoneNumber').like('123');
var records = sys.data.find(query);
log('total: '+records.count());
while (records.hasNext()) {
  log(records.next().label());
}
finds companies with contact phone number like '123'

GET /data/companies?contactInformation.phoneNumber=like(123)

Aggregate queries

Please check the documentation for Aggregate queries for more information.

Available operators

Operator Supported Notes

sum

no

avg

no

first

yes

last

yes

min

yes

max

yes

UI queries

Please check the documentation for UI queries for more information.

Matching of values

Property Description

Matching operator

like

Special values

Available operators

Operator Supported Notes

Many values

yes

Greater

no

Greater or equals

no

Less

yes

Less or equals

yes

Between

no

Back to top