Skip to content

Set contact ID instead of formatted value on output

mattwire requested to merge mattwire/dataprocessor:contactid into master

Setup a dataprocessor such as below json. Display contact id as link to contact record.

  • What happens: Fatal error because $ids passed to CRM_Contact_Form_DataProcessorContactSearch::alterRows is an array of fully formatted URLs (eg. <a href...) instead of the expected list of contact IDs.
  • What should happen: List of contacts displayed.

I'm not sure if this fix is completely correct, but the issue is that the $ids array needs to contain integer IDs and it does not!

{
    "name": "test",
    "title": "test",
    "type": "default",
    "is_active": "1",
    "configuration": [],
    "aggregation": [],
    "storage_configuration": [],
    "data_sources": [
        {
            "weight": "1",
            "name": "contact",
            "title": "Contact",
            "type": "contact",
            "configuration": {
                "filter": {
                    "is_deleted": {
                        "op": "=",
                        "value": "0"
                    }
                }
            },
            "join_configuration": {
                "left_prefix": "contact",
                "left_field": "id",
                "right_prefix": "participant",
                "right_field": "contact_id"
            }
        }
    ],
    "filters": [],
    "fields": [
        {
            "weight": "1",
            "name": "contact_id",
            "title": "Contact ID",
            "type": "contact_link",
            "configuration": {
                "contact_id_field": "id",
                "contact_id_datasource": "contact",
                "contact_name_field": "display_name",
                "contact_name_datasource": "contact"
            }
        }
    ],
    "outputs": [
        {
            "type": "contact_search",
            "configuration": {
                "title": "test",
                "contact_id_field": "contact_id",
                "hide_id_field": "0",
                "help_text": "",
                "navigation_parent_path": "Search"
            },
            "permission": "access CiviCRM"
        }
    ]
}

Merge request reports

Loading