0

What does the 'type' refer to in the results of 'getfields' action of the Contact Entity. It has a numeric value (1,2, 16 etc). Below are a few sample results.

        "id": {
        "name": "id",
        "type": 1,
        "title": "Contact ID",
        "description": "Unique Contact ID",
        "required": true,
        "import": true,
        "where": "civicrm_contact.id",
        "headerPattern": "/internal|contact?|id$/i",
        "export": true,
        "table_name": "civicrm_contact",
        "entity": "Contact",
        "bao": "CRM_Contact_BAO_Contact",
        "localizable": 0,
        "add": "1.1",
        "is_core_field": true,
        "api.aliases": [
            "contact_id"
        ]
    },
    "contact_type": {
        "name": "contact_type",
        "type": 2,
        "title": "Contact Type",
        "description": "Type of Contact.",
        "maxlength": 64,
        "size": 30,
        "where": "civicrm_contact.contact_type",
        "export": true,
        "contactType": null,
        "table_name": "civicrm_contact",
        "entity": "Contact",
        "bao": "CRM_Contact_BAO_Contact",
        "localizable": 0,
        "html": {
            "type": "Select",
            "maxlength": 64,
            "size": 30
        },
        "pseudoconstant": {
            "table": "civicrm_contact_type",
            "keyColumn": "name",
            "labelColumn": "label",
            "condition": "parent_id IS NULL"
        },
        "add": "1.1",
        "is_core_field": true
    },
    "contact_sub_type": {
        "name": "contact_sub_type",
        "type": 2,
        "title": "Contact Subtype",
        "description": "May be used to over-ride contact view and edit templates.",
        "maxlength": 255,
        "size": 45,
        "import": true,
        "where": "civicrm_contact.contact_sub_type",
        "headerPattern": "/C(ontact )?(subtype|sub-type|sub type)/i",
        "export": true,
        "table_name": "civicrm_contact",
        "entity": "Contact",
        "bao": "CRM_Contact_BAO_Contact",
        "localizable": 0,
        "serialize": 1,
        "html": {
            "type": "Select",
            "maxlength": 255,
            "size": 45
        },
        "pseudoconstant": {
            "table": "civicrm_contact_type",
            "keyColumn": "name",
            "labelColumn": "label",
            "condition": "parent_id IS NOT NULL"
        },
        "add": "1.5",
        "is_core_field": true
    },
    "do_not_email": {
        "name": "do_not_email",
        "type": 16,
        "title": "Do Not Email",
        "import": true,
        "where": "civicrm_contact.do_not_email",
        "headerPattern": "/d(o )?(not )?(email)/i",
        "dataPattern": "/^\\d{1,}$/",
        "export": true,
        "default": "0",
        "table_name": "civicrm_contact",
        "entity": "Contact",
        "bao": "CRM_Contact_BAO_Contact",
        "localizable": 0,
        "html": {
            "type": "CheckBox"
        },
        "add": "1.1",
        "is_core_field": true
    }
1
  • I suspect it's the contact type and/or or contact sub type? Api v4 let's you select the load options so try with setting to 'id', 'name', 'label' - mine returned: "id": "Household", "label": "Household", "name": "Household" Nov 9 '20 at 15:23
1

type is the data type - eg Integer, String, Boolean.

If you use APIv4 Contact.getfields returns data_type with more obvious strings. For example:

"data_type": "Integer"

"data_type": "String",

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.