Phone Data Type is a type of string that contains a properly-formatted phone number, including a country code as well as the appropriate number of digits.
Note that a "properly-formatted" phone number is not necessarily an "existing" phone number. See the Examples section for further discussion.
Phone Data Type is a subcategory of the
Text Data Type. Like the
Text Data Type, it is delineated by quotation marks. It must also take the form of a phone number, consisting of a country code as well as the appropriate number of digits.
Phone Data Type can be used to set a value for
actor.phone, allowing the Actor to be initialized with the capacity to text messages and phone calls.
Under the hood, the ISPHONE function is used to determine if a user has given a valid
Phone Data Type. For instance, the following example is a valid phone number:
ISPHONE("+1(314)325-1156") -> TRUE
The ISPHONE function ignores the placement of parentheses and hyphens entirely when evaluating whether the given string is a valid phone number. The following example has hyphens and a parenthesis inserted indiscriminately, and ISPHONE still recognizes it as a valid phone number:
ISPHONE("+13(1-43-25-1156") -> TRUE
If a you have collected a phone number that is not formatted as a valid
Phone Data Type, the PARSE_PHONE function can be used to covert it. For instance, the string "(716) 776-2323" refers to a phone number without a country code. The following example uses the PARSE_PHONE function in tandem with a country designation to return a properly-formatted
Phone Data Type:
PARSE_PHONE("(716) 776-2323", "US") -> "+17167762323"