diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index e97972ad..59b3ce27 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,6 +1,6 @@ { "name": "sfpowerkit", - "version": "2.8.6", + "version": "2.8.7", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/oclif.manifest.json b/oclif.manifest.json index e7698e45..f378ffa1 100644 --- a/oclif.manifest.json +++ b/oclif.manifest.json @@ -1,5 +1,5 @@ { - "version": "2.8.6", + "version": "2.8.7", "commands": { "sfpowerkit:auth:login": { "id": "sfpowerkit:auth:login", diff --git a/package.json b/package.json index 7f94f3e0..05b7193d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sfpowerkit", - "version": "2.8.6", + "version": "2.8.7", "author": { "name": "DXatScale", "email": "dxatscale@accenture.com" diff --git a/src/impl/metadata/retriever/metadataRetriever.ts b/src/impl/metadata/retriever/metadataRetriever.ts index 9ed51eec..f00b83bb 100644 --- a/src/impl/metadata/retriever/metadataRetriever.ts +++ b/src/impl/metadata/retriever/metadataRetriever.ts @@ -212,9 +212,21 @@ export default class MetadataRetriever { try { SFPowerkit.log(`Fetching RecordTypes`, LoggerLevel.TRACE); - let query = `SELECT Name, DeveloperName, SobjectType, NameSpacePrefix, IsPersonType FROM RecordType`; let queryUtil = new QueryExecutor(this._conn); - recordTypes = await queryUtil.executeQuery(query, false); + + let isPersonAccountFieldDefinitionQuery = `SELECT QualifiedApiName FROM FieldDefinition WHERE EntityDefinition.QualifiedApiName='Account' AND QualifiedApiName='IsPersonAccount'`; + let isPersonAccountFieldDefinitionRecords = await queryUtil.executeQuery( + isPersonAccountFieldDefinitionQuery, + true + ); + + let recordTypeQuery: string; + if (isPersonAccountFieldDefinitionRecords.length > 0) + recordTypeQuery = `SELECT Name, DeveloperName, SobjectType, NameSpacePrefix, IsPersonType FROM RecordType`; + else + recordTypeQuery = `SELECT Name, DeveloperName, SobjectType, NameSpacePrefix FROM RecordType`; + + recordTypes = await queryUtil.executeQuery(recordTypeQuery, false); recordTypes = recordTypes.map((recordType) => { let namespace = ""; @@ -237,7 +249,8 @@ export default class MetadataRetriever { return rtObj; }); } catch (error) { - SFPowerkit.log(`Error fetching record types...`, LoggerLevel.TRACE); + SFPowerkit.log(`Error fetching record types...`, LoggerLevel.DEBUG); + SFPowerkit.log(error.message, LoggerLevel.DEBUG); } return recordTypes; }