From d2870ea2e9bd88fb7986f6a8e690277b1b0cb3d9 Mon Sep 17 00:00:00 2001 From: hknokh2 Date: Wed, 13 Mar 2024 00:56:54 +0200 Subject: [PATCH] fix: Fixed #677 --- .../components/common_components/sfdx.ts | 18 ++++++------------ .../components/common_components/statics.ts | 4 ++++ src/modules/models/script_models/script.ts | 3 +++ 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/modules/components/common_components/sfdx.ts b/src/modules/components/common_components/sfdx.ts index 1e8c54ee6..9ab26963d 100644 --- a/src/modules/components/common_components/sfdx.ts +++ b/src/modules/components/common_components/sfdx.ts @@ -205,20 +205,14 @@ export class Sfdx implements IAppSfdxService, IFieldMapping { this.logger.infoVerbose(RESOURCES.usingBulkAPIQuery, parsedQuery.sObject); } - // Query records ///// let records = [].concat(await ___queryAsync(soql)); - if (!parsedQuery.where) { - if (/FROM Group([\s]+|$)/i.test(soql)) { - soql = soql.replace(/FROM\s+Group/i, "FROM User"); - records = records.concat(await ___queryAsync(soql)); - } else if (/FROM User([\s]+|$)/i.test(soql)) { - const parsedUserQuery = parseQuery(soql); - parsedUserQuery.sObject = 'Group'; - parsedUserQuery.where = Common.composeWhereClause(parsedUserQuery.where, "Type", "Queue", "=", "STRING", "AND"); - soql = composeQuery(parsedUserQuery); - records = records.concat(await ___queryAsync(soql)); - } + if (parsedQuery.sObject == 'User') { + let parsedGroupQuery = parseQuery(soql); + parsedGroupQuery.sObject = 'Group'; + parsedGroupQuery.where = Common.composeWhereClause(null, "Type", "Queue", "=", "STRING", "AND"); + soql = composeQuery(parsedGroupQuery); + records = records.concat(await ___queryAsync(soql)); } // Map records ///// diff --git a/src/modules/components/common_components/statics.ts b/src/modules/components/common_components/statics.ts index e953d3295..0c43b314a 100644 --- a/src/modules/components/common_components/statics.ts +++ b/src/modules/components/common_components/statics.ts @@ -113,6 +113,10 @@ export const CONSTANTS = { 'RecordType': 'DeveloperName;NamespacePrefix;SobjectType' }, + EXCLUDED_OBJECTS: [ + 'Group' + ], + NOT_SUPPORTED_OBJECTS: [ 'Profile', 'User', diff --git a/src/modules/models/script_models/script.ts b/src/modules/models/script_models/script.ts index d02c2e3b2..961a673d3 100644 --- a/src/modules/models/script_models/script.ts +++ b/src/modules/models/script_models/script.ts @@ -327,6 +327,9 @@ export default class Script implements IAppScript, ISfdmuRunScript { // Remove excluded objects and unsupported objects this.objects = this.objects.filter(object => { + if (CONSTANTS.EXCLUDED_OBJECTS.includes(object.name)) { + return false; + } let supportedObjectsForOpertation = CONSTANTS.SUPPORTED_OBJECTS_FOR_OPERATION.get(object.name) || []; let isSupportedForOperation = !supportedObjectsForOpertation.length || supportedObjectsForOpertation.length && supportedObjectsForOpertation.includes(object.strOperation);