Skip to content

Commit

Permalink
fix: Fixed #677
Browse files Browse the repository at this point in the history
  • Loading branch information
hknokh2 committed Mar 12, 2024
1 parent 3f7fbed commit d2870ea
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/modules/components/common_components/sfdx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 /////
Expand Down
4 changes: 4 additions & 0 deletions src/modules/components/common_components/statics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ export const CONSTANTS = {
'RecordType': 'DeveloperName;NamespacePrefix;SobjectType'
},

EXCLUDED_OBJECTS: [
'Group'
],

NOT_SUPPORTED_OBJECTS: [
'Profile',
'User',
Expand Down
3 changes: 3 additions & 0 deletions src/modules/models/script_models/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d2870ea

Please sign in to comment.