cf(uid, code)

Function name Description
cf(uid, code) Returns the value of the specified custom field for the given UID.
Parameter name Description
uid The UID (account or subscription ID) of the object which holds the custom field.
code The code of the custom field you wish to retrieve.

The cf(uid, code) function returns a specific custom field for a given account. This is the most useful custom field function because it allows you to extract specific information about an account based on your requirements.

Unlike cf(uid), this method returns a single value and is intended to be used as a column.

For example, to print the name and account balance for all accounts, you could use:

SELECT cf(account, 'contactNameGiven') AS "Given", cf(account, 'contactNameFamily') AS "Family", balance FROM account_balance;
   Given  |  Family  |  balance
 ---------+----------+----------
 Paul     | Keating  |  1428.00
 George   | Bush     |   900.00
 Malcolm  | Fraser   |   900.00
 Barack   | Obama    |   900.00