Import the relationship SK from the searchkit UI
[
[
"SavedSearch",
"save",
{
"records": [
{
"name": "Contact_Summary_Relationships",
"label": "Contact Summary Relationships",
"api_entity": "RelationshipCache",
"api_params": {
"version": 4,
"select": [
"near_relation:label",
"RelationshipCache_Contact_far_contact_id_01.display_name",
"start_date",
"end_date",
"RelationshipCache_Contact_far_contact_id_01.address_primary.city",
"RelationshipCache_Contact_far_contact_id_01.address_primary.state_province_id:label",
"RelationshipCache_Contact_far_contact_id_01.email_primary.email",
"RelationshipCache_Contact_far_contact_id_01.phone_primary.phone",
"permission_near_to_far:label",
"permission_far_to_near:label",
"is_active"
],
"orderBy": [],
"where": [],
"groupBy": [],
"join": [
[
"Contact AS RelationshipCache_Contact_far_contact_id_01",
"LEFT",
[
"far_contact_id",
"=",
"RelationshipCache_Contact_far_contact_id_01.id"
]
],
[
"Case AS RelationshipCache_Case_case_id_01",
"LEFT",
[
"case_id",
"=",
"RelationshipCache_Case_case_id_01.id"
]
]
],
"having": []
}
}
],
"match": [
"name"
]
}
],
[
"SearchDisplay",
"save",
{
"records": [
{
"name": "Contact_Summary_Relationships_Active",
"label": "Contact Summary Relationships Active",
"saved_search_id.name": "Contact_Summary_Relationships",
"type": "table",
"settings": {
"description": null,
"sort": [],
"limit": 50,
"pager": {
"hide_single": true,
"expose_limit": true
},
"placeholder": 5,
"columns": [
{
"type": "field",
"key": "near_relation:label",
"dataType": "String",
"label": "Relationship",
"sortable": true,
"icons": [
{
"field": "permission_far_to_near:icon",
"side": "left"
}
]
},
{
"type": "field",
"key": "RelationshipCache_Contact_far_contact_id_01.display_name",
"dataType": "String",
"label": "With",
"sortable": true,
"icons": [
{
"field": "RelationshipCache_Contact_far_contact_id_01.contact_sub_type:icon",
"side": "left"
},
{
"field": "RelationshipCache_Contact_far_contact_id_01.contact_type:icon",
"side": "left"
},
{
"field": "permission_near_to_far:icon",
"side": "right"
}
],
"link": {
"path": "",
"entity": "Contact",
"action": "view",
"join": "RelationshipCache_Contact_far_contact_id_01",
"target": "_blank"
},
"title": "View Related Contact"
},
{
"type": "field",
"key": "start_date",
"dataType": "Date",
"label": "Dates",
"sortable": true,
"rewrite": "[start_date] - [end_date]"
},
{
"type": "field",
"key": "RelationshipCache_Contact_far_contact_id_01.address_primary.city",
"dataType": "String",
"label": "City",
"sortable": true
},
{
"type": "field",
"key": "RelationshipCache_Contact_far_contact_id_01.address_primary.state_province_id:label",
"dataType": "Integer",
"label": "State/Prov",
"sortable": true
},
{
"type": "field",
"key": "RelationshipCache_Contact_far_contact_id_01.email_primary.email",
"dataType": "String",
"label": "Email",
"sortable": true,
"icons": [
{
"icon": "fa-ban",
"side": "left",
"if": [
"RelationshipCache_Contact_far_contact_id_01.do_not_email",
"=",
true
]
}
]
},
{
"type": "field",
"key": "RelationshipCache_Contact_far_contact_id_01.phone_primary.phone",
"dataType": "String",
"label": "Phone",
"sortable": true,
"icons": [
{
"icon": "fa-ban",
"side": "left",
"if": [
"RelationshipCache_Contact_far_contact_id_01.do_not_phone",
"=",
true
]
}
]
},
{
"text": "",
"style": "default",
"size": "btn-xs",
"icon": "fa-bars",
"links": [
{
"entity": "Relationship",
"action": "view",
"join": "",
"target": "crm-popup",
"icon": "fa-external-link",
"text": "View Relationship",
"style": "default",
"path": "",
"task": "",
"condition": []
},
{
"entity": "Relationship",
"action": "update",
"join": "",
"target": "crm-popup",
"icon": "fa-pencil",
"text": "Update Relationship",
"style": "default",
"path": "",
"task": "",
"condition": []
},
{
"task": "disable",
"entity": "Relationship",
"join": "",
"target": "crm-popup",
"icon": "fa-toggle-off",
"text": "Disable Relationship",
"style": "default",
"path": "",
"action": "",
"condition": [
"is_active",
"=",
true
]
},
{
"entity": "Relationship",
"action": "delete",
"join": "",
"target": "crm-popup",
"icon": "fa-trash",
"text": "Delete Relationship",
"style": "danger",
"path": "",
"task": "",
"condition": []
},
{
"entity": "Case",
"action": "view",
"join": "RelationshipCache_Case_case_id_01",
"target": "",
"icon": "fa-folder-open",
"text": "Manage Case",
"style": "default",
"condition": []
}
],
"type": "menu",
"alignment": "text-right"
}
],
"actions": false,
"classes": [
"table",
"table-striped"
],
"toolbar": [
{
"action": "add",
"entity": "Relationship",
"text": "Add Relationship",
"icon": "fa-plus",
"style": "primary",
"target": "crm-popup",
"join": "",
"path": "",
"task": "",
"condition": []
}
]
}
},
{
"name": "Contact_Summary_Relationships_Inactive",
"label": "Contact Summary Relationships Inactive",
"saved_search_id.name": "Contact_Summary_Relationships",
"type": "table",
"settings": {
"description": "These relationships are Disabled OR have a past End Date.",
"sort": [],
"limit": 50,
"pager": {
"hide_single": true,
"expose_limit": true
},
"placeholder": 5,
"columns": [
{
"type": "field",
"key": "near_relation:label",
"dataType": "String",
"label": "Relationship",
"sortable": true,
"icons": [
{
"field": "permission_far_to_near:icon",
"side": "left"
}
]
},
{
"type": "field",
"key": "RelationshipCache_Contact_far_contact_id_01.display_name",
"dataType": "String",
"label": "With",
"sortable": true,
"icons": [
{
"field": "RelationshipCache_Contact_far_contact_id_01.contact_sub_type:icon",
"side": "left"
},
{
"field": "RelationshipCache_Contact_far_contact_id_01.contact_type:icon",
"side": "left"
},
{
"field": "permission_near_to_far:icon",
"side": "right"
}
],
"link": {
"path": "",
"entity": "Contact",
"action": "view",
"join": "RelationshipCache_Contact_far_contact_id_01",
"target": "_blank"
},
"title": "View Related Contact"
},
{
"type": "field",
"key": "start_date",
"dataType": "Date",
"label": "Dates",
"sortable": true,
"rewrite": "[start_date] - [end_date]"
},
{
"type": "field",
"key": "RelationshipCache_Contact_far_contact_id_01.address_primary.city",
"dataType": "String",
"label": "City",
"sortable": true
},
{
"type": "field",
"key": "RelationshipCache_Contact_far_contact_id_01.address_primary.state_province_id:label",
"dataType": "Integer",
"label": "State/Prov",
"sortable": true
},
{
"type": "field",
"key": "RelationshipCache_Contact_far_contact_id_01.email_primary.email",
"dataType": "String",
"label": "Email",
"sortable": true,
"icons": [
{
"icon": "fa-ban",
"side": "left",
"if": [
"RelationshipCache_Contact_far_contact_id_01.do_not_email",
"=",
true
]
}
]
},
{
"type": "field",
"key": "RelationshipCache_Contact_far_contact_id_01.phone_primary.phone",
"dataType": "String",
"label": "Phone",
"sortable": true,
"icons": [
{
"icon": "fa-ban",
"side": "left",
"if": [
"RelationshipCache_Contact_far_contact_id_01.do_not_phone",
"=",
true
]
}
]
},
{
"text": "",
"style": "default",
"size": "btn-xs",
"icon": "fa-bars",
"links": [
{
"entity": "Relationship",
"action": "view",
"join": "",
"target": "crm-popup",
"icon": "fa-external-link",
"text": "View Relationship",
"style": "default",
"path": "",
"task": "",
"condition": []
},
{
"entity": "Relationship",
"action": "update",
"join": "",
"target": "crm-popup",
"icon": "fa-pencil",
"text": "Update Relationship",
"style": "default",
"path": "",
"task": "",
"condition": []
},
{
"task": "enable",
"entity": "Relationship",
"join": "",
"target": "crm-popup",
"icon": "fa-toggle-on",
"text": "Enable Relationship",
"style": "default",
"path": "",
"action": "",
"condition": [
"is_active",
"=",
false
]
},
{
"entity": "Relationship",
"action": "delete",
"join": "",
"target": "crm-popup",
"icon": "fa-trash",
"text": "Delete Relationship",
"style": "danger",
"path": "",
"task": "",
"condition": []
}
],
"type": "menu",
"alignment": "text-right"
}
],
"actions": false,
"classes": [
"table",
"table-striped",
"disabled"
]
}
}
],
"match": [
"saved_search_id",
"name"
]
}
],
[
"Afform",
"save",
{
"records": [
{
"type": "search",
"title": "Relationships",
"permission": [
"access CiviCRM"
],
"placement": [
"contact_summary_tab"
],
"icon": "fa-handshake-o",
"summary_weight": 80,
"permission_operator": "AND",
"layout": "<div af-fieldset=\"\">\n <div class=\"alert alert-warning\">\n <strong>{{:: ts('Permissioned Relationships:') }}</strong>\n <i class=\"crm-i fa-eye\"></i> {{:: ts('This contact can be viewed by the other.') }}\n <i class=\"crm-i fa-pencil-square\"></i> {{:: ts('This contact can be viewed and edited by the other.') }}\n </div>\n <crm-search-display-table search-name=\"Contact_Summary_Relationships\" display-name=\"Contact_Summary_Relationships_Active\" filters=\"{near_contact_id: options.contact_id, is_current: true}\"></crm-search-display-table>\n <crm-search-display-table search-name=\"Contact_Summary_Relationships\" display-name=\"Contact_Summary_Relationships_Inactive\" filters=\"{near_contact_id: options.contact_id, is_current: false}\"></crm-search-display-table>\n</div>\n",
"name": "afsearchTabRel",
"modified_date": "2023-11-30 15:10:47",
"requires": null,
"entity_type": null,
"join_entity": null,
"description": null,
"summary_contact_type": null,
"server_route": null,
"is_public": false,
"redirect": null,
"submit_enabled": true,
"submit_limit": null,
"create_submission": null,
"navigation": null
}
]
}
]
]