Datatable: Add Picklist Support for Apex-Defined Data #1673
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 existingcomboboxcolumn 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
apex_picklistFieldMapfrom a private property to an@apiproperty with getter/setterpicklisttocomboboxfor Apex-Defined data (lines 1735-1738)3. ers_datatableCPE.js
Added
apex_picklistFieldMapto theinputValuesobject 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":""}]}