Skip to content

Commit

Permalink
fix(picklist-decoding-issue): decode values before update (dxatscale#…
Browse files Browse the repository at this point in the history
…1386)

Co-authored-by: Azlam <[email protected]>
  • Loading branch information
Rocko1204 and azlam-abdulsalam authored Aug 15, 2023
1 parent abad219 commit 0ed7416
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions packages/core/src/package/deploymentCustomizers/PicklistEnabler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,16 @@ export default class PicklistEnabler implements DeploymentCustomizer {
let picklistValueInOrg = [];

for (const value of picklistInOrg.Metadata.valueSet.valueSetDefinition.value) {
if (value.isActive == 'false') {
//ignore inactive values from org
if (value.isActive == false) {
continue;
}

let valueInfo: { [key: string]: string } = {};
valueInfo.fullName = value['valueName'];
decodeURIComponent(valueInfo.fullName);
valueInfo.label = value['label'];
decodeURIComponent(valueInfo.label);
valueInfo.default = value['default'] && value['default'] === true ? 'true' : 'false';
picklistValueInOrg.push(valueInfo);
}
Expand Down Expand Up @@ -146,9 +149,17 @@ export default class PicklistEnabler implements DeploymentCustomizer {
let values = customField.valueSet?.valueSetDefinition?.value;
//only push values when picklist > 1 or exactly 1 value
if (Array.isArray(values)) {
picklistValueSet.push(...values);
for (const value of values) {
//ignore inactive values from source
if(!value?.isActive || value?.isActive == 'true'){
picklistValueSet.push({fullName: value['fullName'] ? decodeURI(value['fullName']) : value['fullName'] , default: value.default, label: value['label'] ? decodeURI(value['label']) : value['label']});
}
}
} else if (typeof values === 'object' && 'fullName' in values) {
picklistValueSet.push(values);
//ignore inactive values from source
if(!values?.isActive || values?.isActive == 'true'){
picklistValueSet.push({fullName: values['fullName'] ? decodeURI(values['fullName']) : values['fullName'] , default: values.default, label: values['label'] ? decodeURI(values['label']) : values['label']});
}
}
return picklistValueSet;
}
Expand Down

0 comments on commit 0ed7416

Please sign in to comment.