Datatable: Add Picklist Support for Apex-Defined Data
This PR exposes the exisitng apex_picklistFieldMap, and allows Flow builders to manually specify picklist values for user-defined data. The component automatically converts picklist column types to the existing combobox column infrastructure when manual values are provided.
The datatable component currently supports editable picklist columns only for standard Salesforce SObjects. When using Apex-Defined objects or serialized JSON data, picklist columns render as plain text inputs instead of dropdowns because the component has no access to field metadata.
Changes
1. datatable.js-meta.xml
Added new Flow input parameter apex_picklistFieldMap. Exposes the picklist configuration to Flow builders so they can specify dropdown values for user-defined data.
The input format Follows the standard format used by lightning-combobox:
{
"fieldName": [
{"label": "Display Text", "value": "actual_value"},
{"label": "Another Option", "value": "another_value"}
]
}
2. datatable.js
- Converted
apex_picklistFieldMapfrom a private property to an@apiproperty with getter/setter - Added logic to transform the user-friendly array format into the internal map format.
- Added automatic column type conversion from
picklisttocomboboxfor Apex-Defined data (lines 1735-1738)
3. ers_datatableCPE.js
Added apex_picklistFieldMap to the inputValues object and help sections. Makes the parameter available in the Custom Property Editor (Flow Builder UI) so users can configure it visually instead of manually editing Flow XML.
4. ers_datatableCPE.html
Added UI input field for apex_picklistFieldMap. Only displays when "Input data is Apex-Defined" is enabled, preventing confusion for users working with standard SObjects. We could also leave this out, if we wanted to allow subscribers to optionally customize picklist values for SObjects.
Example
Input Data:
[{"url":"/003QL000015eYQzYAM","name":"John Doe","title":"President","roleName":"Decision Maker","roleId":"00KQL00000LBT7R2AX","email":"[email protected]","contactId":"003QL000015eYQzYAM"},{"url":"/003QL000015eYR0YAM","name":"Jane Doe","title":"Vice President","roleName":null,"roleId":null,"email":"[email protected]","contactId":"003QL000015eYR0YAM"},{"url":"/003QL000015eYR1YAM","name":"JimBob Doe","title":"Assistant to the Regional Manager","roleName":null,"roleId":null,"email":"[email protected]","contactId":"003QL000015eYR1YAM"}]
Column Picklist Values:
{"roleName":[{"label":"Decision Maker","value":"Decision Maker"},{"label":"Evaluator","value":"Evaluator"},{"label":"Influencer","value":"Influencer"},{"label":"--None--","value":""}]}
I will review - thanks for the submission.
@ericrsmith35 Thanks!
Looking back at this, I realized that my auto-format must have kicked in, making the diff much larger than it actually is. When I get a chance, I'll revert that styling to make it easier to grok what actually changed.
Formatting fixed - sorry about that! 🙂