ores.refdata.party_contact_information

Table of Contents

Contact details for parties organised by purpose (Legal, Operations, Settlement, Billing). Each party can have one contact record per type.

1. Flags

2. Columns

2.1. id

UUID uniquely identifying this contact information record.

Surrogate key for the party contact information record.

2.2. party_id

The party this contact information belongs to.

References the parent party record.

uuid_gen()

2.3. contact_type

The type or purpose of this contact.

References the contact_type lookup table (e.g. Legal, Operations).

// no_generator_suffix: validated enum, a "-<idx>" suffix would be invalid.
// Rotate so a batch of several contact rows for one party gets distinct
// types (max one contact row per type per party).
[idx]{
    static constexpr const char* types[] = {
        "Legal", "Operations", "Settlement", "Billing"};
    return std::string(types[idx % 4]);
}()

2.4. street_line_1

First line of the street address.

Primary address line.

std::string("123 Test Street")

2.5. street_line_2

Second line of the street address.

Additional address line (suite, floor, etc.).

std::string("Suite 100")

2.6. city

City name.

City or town of the address.

std::string("London")

2.7. state

State or province.

State, province, or region.

std::string("")

2.8. country_code

ISO 3166-1 alpha-2 country code.

References the countries table (soft FK).

// Left blank: validated against the tenant-scoped countries table, which
// isolated test tenants don't seed; empty skips validation.
std::string("")
-- Paste block: doesn't fit soft_fk_validations (joins on id, not
-- an alpha-2 code column) or the Validations table
-- (ores_refdata_validate_country_fn only checks non-null/empty,
-- not existence).
-- Validate country_code (nullable, inline check against countries table)
if NEW.country_code is not null and NEW.country_code != '' then
    if not exists (
        select 1 from ores_refdata_countries_tbl
        where tenant_id = NEW.tenant_id
          and alpha2_code = NEW.country_code
          and valid_to = ores_utility_infinity_timestamp_fn()
    ) then
        raise exception 'Invalid country_code: %. Must be a valid ISO 3166-1 alpha-2 code.',
            NEW.country_code
            using errcode = '23503';
    end if;
end if;

2.9. postal_code

Postal or ZIP code.

Postal code for the address.

std::string("EC2V 8AS")

2.10. phone

Phone number.

Contact phone number in international format.

std::string("+44 20 7000 0000")

2.11. email

Email address.

Contact email address.

std::string("contact@example.com")

2.12. web_page

Web page URL.

Contact web page address.

std::string("https://example.com")

2.13. is_primary

Whether this is the contact to call. At most one live contact row per party may hold it.

A party holds one row per contact_type, so the rows are (Legal, Operations, Settlement, Billing) and nothing in them says which one a person should ring. The mark lives on the row so that it survives a reload, rather than in the session that set it.

// The first row a batch generates is the primary one, and four contact types
// rotate per party, so at most one of a party's rows is marked.
[idx]{
    return idx % 4 == 0;
}()

3. Artefact columns

A dataset of contacts is scoped to the party a publish names, so it carries no party. ores_refdata_publish_party_contact_informations_from_dq_fn supplies party_id and the row id, and a contact whose type the party already holds is left as it is.

3.1. contact_type

3.2. version

3.3. street_line_1

3.4. street_line_2

3.5. city

3.6. state

3.7. country_code

3.8. postal_code

3.9. phone

3.10. email

3.11. web_page

3.12. is_primary

4. SQL

4.1. Flags

4.2. Indexes

A second contact cannot claim the mark while the first holds it. The write is refused rather than quietly leaving two rows that both say they are primary.

name columns unique current_only where_extra
primary_party_contact_uniq party_id true false is_primary and valid_to = ores_utility_infinity_timestamp_fn()

5. Foreign keys

5.1. party_id

6. Insert trigger

6.1. Validations

column validation_function
contact_type ores_refdata_validate_contact_type_fn

7. C++

7.1. Flags

7.2. Repository

7.3. Domain includes

#include <string>
#include <boost/uuid/uuid.hpp>

7.4. Entity includes

#include <string>

7.5. Conventions

7.6. Table display

column header
party_id Party
contact_type Type
city City
country_code Country
phone Phone
email Email
modified_by Modified By
version Version

7.7. Custom repository methods

7.8. Presentation

Note: party_id is deliberately not exposed as a Detail field – like Book's parent_portfolio_id, it's always known from the owning context (the party's own Contact Information tab) and set programmatically before the dialog is shown, never user-chosen.

7.8.1. Detail fields

field label widget type is_key is_required placeholder flag_source combo_allow_blank combo_fetch combo_domain_type combo_fetch_include combo_fetch_fn combo_watcher_name combo_code_field combo_tooltip_field combo_sort_field combo_label combo_setter_pascal badge_key
id Id idEdit line_edit true true Contact id                          
contact_type Type contactTypeCombo dynamic_combo false true         refdata::domain::contact_type   fetch_contact_types contactTypeWatcher code description display_order contact types ContactTypeCombo  
street_line_1 Street Line 1 streetLine1Edit line_edit false false Enter street line 1                          
street_line_2 Street Line 2 streetLine2Edit line_edit false false Enter street line 2                          
city City cityEdit line_edit false false Enter city                          
state State stateEdit line_edit false false Enter state                          
country_code Country Code countryCodeCombo flagged_combo false false   country true fetch_country_codes                    
postal_code Postal Code postalCodeEdit line_edit false false Enter postal code                          
phone Phone phoneEdit line_edit false false Enter phone                          
email Email emailEdit line_edit false false Enter email                          
web_page Web Page webPageEdit line_edit false false Enter web page                          

7.8.2. Columns

enum_name field header type width
ContactType contact_type Type string 120
StreetLine1 street_line_1 Street string 180
City city City string 120
CountryCode country_code Country string 100
Phone phone Phone string 140
Email email Email string 180
Version version Version int 80
ModifiedBy modified_by Modified By string 120
RecordedAt recorded_at Recorded At timestamp 150

7.8.3. Icon columns

column accessor field1 field2
CountryCode country_flag_icon country_code  

8. See also

Emacs 29.3 (Org mode 9.6.15)