From 088c2d4ee00fe3edeb67f055873f4eb2424468ac Mon Sep 17 00:00:00 2001 From: colemanw Date: Tue, 16 May 2023 17:48:00 -0400 Subject: [PATCH] SearchKit - Remove hard-coding of 'match' param As of 98511f0 the API Export action now returns the correct value for 'match' by default, so it no longer needs to be hard-coded. --- .../crmSearchAdmin/crmSearchAdminExport.component.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ext/search_kit/ang/crmSearchAdmin/crmSearchAdminExport.component.js b/ext/search_kit/ang/crmSearchAdmin/crmSearchAdminExport.component.js index 7f1448835f..a307b60ddf 100644 --- a/ext/search_kit/ang/crmSearchAdmin/crmSearchAdminExport.component.js +++ b/ext/search_kit/ang/crmSearchAdmin/crmSearchAdminExport.component.js @@ -34,8 +34,10 @@ crmApi4(apiCalls) .then(function(result) { _.each(ctrl.types, function (type) { - type.values = _.pluck(_.pluck(_.where(result[0], {entity: type.entity}), 'params'), 'values'); - type.enabled = !!type.values.length; + var params = _.pluck(_.where(result[0], {entity: type.entity}), 'params'); + type.values = _.pluck(params, 'values'); + type.match = params[0] && params[0].match; + type.enabled = !!params.length; }); // Afforms are not included in the export and are fetched separately if (ctrl.afformEnabled) { @@ -50,10 +52,8 @@ _.each(ctrl.types, function(type) { if (type.enabled) { var params = {records: type.values}; - // Afform always matches on 'name', no need to add it to the API 'save' params - if (type.entity !== 'Afform') { - // Group and SavedSearch match by 'name', SearchDisplay also matches by 'saved_search_id'. - params.match = type.entity === 'SearchDisplay' ? ['name', 'saved_search_id'] : ['name']; + if (type.match && type.match.length) { + params.match = type.match; } data.push([type.entity, 'save', params]); } -- 2.25.1