From 65e36ee91bbb22eebb73795a5684ddd5cbf973cf Mon Sep 17 00:00:00 2001 From: Craig Bradshaw Date: Fri, 24 Nov 2023 20:33:16 +0000 Subject: [PATCH] fix(picklist): Cannot read properties of undefined (reading 'Metadata') * issues/1441 : Bug fix for picklist Deployment fixes the Cannot read properties of undefined (reading 'Metadata') included some trace logging for troubleshooting * fix: remove comment --------- Co-authored-by: Azlam <43767972+azlam-abdulsalam@users.noreply.github.com> --- .../package/deploymentCustomizers/PicklistEnabler.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/core/src/package/deploymentCustomizers/PicklistEnabler.ts b/packages/core/src/package/deploymentCustomizers/PicklistEnabler.ts index 922d0a71e..dc22dd4c9 100644 --- a/packages/core/src/package/deploymentCustomizers/PicklistEnabler.ts +++ b/packages/core/src/package/deploymentCustomizers/PicklistEnabler.ts @@ -74,8 +74,15 @@ export default class PicklistEnabler implements DeploymentCustomizer { let picklistInOrg = await this.getPicklistInOrg(urlId, sfpOrg.getConnection()); - //check for empty picklists on org and fix first deployment issue - if (!picklistInOrg && picklistInOrg?.Metadata?.valueSet?.valueSetDefinition) continue; + if (!picklistInOrg?.Metadata?.valueSet?.valueSetDefinition) + SFPLogger.log( + `Picklist field ${objName}.${picklistName} not in target Org. Skipping`, + LoggerLevel.TRACE, + logger + ); + continue; + } + let picklistValueInOrg = []; @@ -115,6 +122,7 @@ export default class PicklistEnabler implements DeploymentCustomizer { } } catch (error) { SFPLogger.log(`Unable to process Picklist update due to ${error.message}`, LoggerLevel.WARN, logger); + SFPLogger.log(`Error Details : ${error.stack}`, LoggerLevel.TRACE); } }