Skip to content
This repository was archived by the owner on Mar 18, 2024. It is now read-only.
This repository was archived by the owner on Mar 18, 2024. It is now read-only.

PicklistAnalyzer errors out if other other non CustomField Metadata is processed first #1367

@cjbradshaw

Description

@cjbradshaw

Describe the bug
The PicklistAnalyzer runs to determine if picklist components should be processed.
If it finds a CustomField of type picklist it marks isPickListsFound as true meaning picklists are processed as part of the run
If you have non CustomField Metadata that appears first in the array of component metadata then the .CustomField accessor fails forcing the processing to error. This means isPickListsFound remains false and picklists are not processed

To Reproduce
Steps to reproduce the behavior:
create a package and include a new custom object :
AD_Test_Plan__c
Include a lookup field to Account called Acccount__c and include a new custom layout with the same api name as the custom object : AD_Test_Plan.compactLayout-meta.xml
image

Run a quickbuild :
sfp orchestrator:quickbuild -v devhub --diffcheck --buildnumber 1 --branch master --loglevel=trace
Run a deploy :
sfp orchestrator:deploy -u dev --loglevel=trace

Expected behavior
The picklist Enabler will error :
"Unable to process Picklist update due to Cannot read properties of undefined (reading 'type')
Pre Deployer Picklist Enabler skipped or not enabled"

image

Looking at the code, the PicklistAnalyzer when it builds the array of components - the .getChildren() can include different types of metadata. Probably simple to fix with a check for customField when it iterates the components

Screenshots
See above

Platform Details (please complete the following information):

  • OS: MacOS
  • Version [e.g. CLI Version eg: 1.6.6] : @dxatscale/sfpowerscripts/22.6.1
  • Salesforce CLI(sfdx cli) Version: 7.194.1
  • CI Platform: Github Actions

Additional context
I've debugged this locally and found a simple fix

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions