Skip to content

Commit

Permalink
fix(picklist): Cannot read properties of undefined (reading 'Metadata')
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
cjbradshaw and azlam-abdulsalam authored Nov 24, 2023
1 parent 300fde5 commit 65e36ee
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/core/src/package/deploymentCustomizers/PicklistEnabler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];

Expand Down Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 65e36ee

Please sign in to comment.