public String getDomain(KeeperRecord record) {

        KeeperRecordData data = record.getData();
        List<KeeperRecordField> custom = data.getCustom();

        // First check text "domain" custom field ...
        Text textField = getField(custom, Text.class, DOMAIN_LABEL_PATTERN);
        if (textField != null)
            return getSingleStringValue(textField.getValue());

        // ... or hidden "domain" custom field if that's not found
        HiddenField hiddenField = getField(custom, HiddenField.class, DOMAIN_LABEL_PATTERN);
        if (hiddenField != null)
            return getSingleStringValue(hiddenField.getValue());

        return null;

    }
Returns the single domain associated with the given record. If the
record has no associated domain, or multiple domains, null is
returned. Domains are retrieved from "Text" and "Hidden" fields
that have the label "domain" (case-insensitive).

@param record
    The record to retrieve the domain from.

@return
    The domain associated with the given record, or null if the record
    has no associated domain or multiple domains.
extensions/guacamole-vault/modules/guacamole-vault-ksm/src/main/java/org/apache/guacamole/vault/ksm/secret/KsmRecordService.java