Click the attribute to load the clipboard with the value to be pasted into your datatableV2 parameter.
150 | 151 |Column Fields:
155 |Column Alignments:
159 |Column Edits:
163 |
Column Filters:
171 |
Column Labels:
179 |Column Widths:
183 |
Clipboard Contents:
191 | 192 |
42 |
43 |
44 | ---
45 | Because the Datatable Configuration Helper uses Metadata APIs, you’ll need to have a Remote Site Setting on the org. If you don’t, you’ll see an error like this:
46 |
47 | `Metadata Transfer
48 | Job Status: Error: "IO Exception: Unauthorized endpoint, please check Setup->Security->Remote site settings. endpoint = https://test35-dev-ed--c.visualforce.com/services/Soap/m/42.0"`
49 |
50 | To address this, copy the root url from the error message and go to Setup –> Remote Site Settings and create a new setting.
51 |
52 | 
53 |
54 | This configures your org to essentially allow applications to run that call out to the internet and then back into the same org via its API endpoints.
55 |
56 | ---
57 | ## Release Notes
58 | 10/14/20 - Eric Smith - Version 2.47 -
59 | Bug Fix: Display correct icon for Table Header (was always showing standard:account icon)
60 |
61 | 10/07/20 - Eric Smith - Version 2.46 -
62 | Updates: Added new Output Parameter for the # of Selected Records
63 | (this can be used for conditional visibility on the same screen as the datatable)
64 | New Selected Record Output Parameter - Returns an SObject record if just a single record is selected
65 | New Required? Parameter - Requires the user to select at least 1 row to proceed
66 | New option to suppress the link for the object's standard Name field
67 | New optional Table Header with Table Icon and Table Label Parameters
68 | Switched DualListbox to the fbc version
69 | Added spinners while sorting & filtering data
70 | Allow case insensitive field API names
71 | Allow custom field API names w/o the __c suffix
72 | Bug Fixes: Display Picklist Labels instead of API Names for Picklist and Multipicklist fields
73 | Added a Clear Selection button for tables with just a single record
74 |
75 | 09/22/20 - Eric Smith - Version 2.45 -
76 | Bug Fix: Fixed inability to edit some field types (introduced by v2.44)
77 |
78 | 09/20/20 - Kevin Hart - Version 2.44 -
79 | Updates: Added ability to display Rich Text fields
80 | Eric Smith - Bug Fix: Fixed error when selecting column action of WrapText or ClipText
81 |
82 | 09/01/20 - Eric Smith - Version 2.43 -
83 | Bug Fix: Update Percent Field Handling and set Formula Fields to be Non-Editable
84 |
85 | 08/26/20 - Eric Smith - Version 2.42 -
86 | Bug Fix: Update Time fields with the User's Timezone Offset value so they display as intended
87 | Bug Fix: Fix field type so Datetime fields display correctly
88 |
89 | 08/14/20 - Eric Smith - Version 2.41 -
90 | Bug Fix: Fixed issue with time and date-time fields being displayed as a day earlier
91 |
92 | 08/11/20 - Eric Smith - Version 2.40 -
93 | Updates: Added attribute to allow the suppression of the record link on the SObject's 'Name' field
94 | Bug Fix: Fixed code so the 'Name' Field column now sorts correctly
95 |
96 | 07/31/20 - Eric Smith - Version 2.39 -
97 | Updates: Added Datatable Configuration Helper Flow
98 | REQUIRES: Flow Base Components (https://unofficialsf.com/introducing-flowbasecomponents/)
99 | REQUIRES: Dual List Box (https://unofficialsf.com/duallistbox/)
100 | REQUIRES: Remote Site Setting (Setup)
101 |
102 | 07/31/20 - Andy Hass - Version 2.38 -
103 | Updates: Added support for Checkbox Field Type
104 |
105 | 07/07/20 - Eric Smith - Version 2.37 -
106 | Bug Fix: Fixed issue with the date being displayed as a day earlier
107 |
108 | 07/01/20 - Eric Smith - Version 2.36 -
109 | Updates: Now displays the primary "Name" field as a Link (textWrap = true)
110 | Added button in Config Mode to round off Column Width values
111 |
112 | 06/30/20 - Eric Smith - Version 2.35 -
113 | Updates: Extended Configuration Mode to handle Column Alignments, Labels, Widths, Allow Edit & Allow Filter
114 | Added Configuration Mode buttons to select all columns for Edit and/or Filter
115 | Selecting an attribute string now copies the contents into the system Clipboard
116 |
117 | 06/24/20 - Eric Smith - Version 2.34 -
118 | Updates: Added Configuration Mode parameter (Used by Datatable Configuration Flow)
119 | Bug Fix: Fixed issue with column widths resetting when filtering
120 |
121 | 06/19/20 - Eric Smith - Version 2.33 -
122 | Updates: Removed default value for Table Height
123 | Bug Fix: Fixed issue with lookup fields being blank in the first record
124 |
125 | 06/03/20 - Eric Smith - Version 2.32 -
126 | Bug Fix: Fixed error when editing more than one column in a single row while suppressing the Cancel/Save buttons
127 |
128 | 06/03/20 - Eric Smith - Version 2.31 -
129 | Updates: Changed SObjectController to SObjectController2 to allow for easier deployment to orgs
130 | that already have an earlier version of the datatable component
131 |
132 | 06/03/20 - Eric Smith - Version 2.3 -
133 | Updates: Changed SObjectController to SObjectController2 to allow for easier deployment to orgs
134 | that already have an earlier version of the datatable component
135 |
136 | 06/03/20 - Eric Smith - Version 2.2 -
137 | Enhancements: Added datatable border attribute
138 | Updates: Fixed attribute parsing, Fixed Spinner
139 |
140 | 06/01/20 - Eric Smith - Version 2.1 -
141 | Enhancements: Updated with features from v1.2 & v1.3
142 |
143 | 04/22/20 - Eric Smith - Version 2.0 (Summer '20) -
144 | Enhancements: Summer '20 New Feature - Dynamic Object Type
145 | One version of the component now supports ALL Standard & Custom SObjects
146 |
147 | 05/23/20 - Eric Smith - Version 1.3 -
148 | Updates: Added support for a serialized JSON string of records of a user defined object
149 | Added an attribute to specify the height of the datatable
150 | Bug Fix - Fixed error when editing multiple rows
151 |
152 | 05/06/20 - Eric Smith - Version 1.2 -
153 | Updates: Handle lookup Objects without a Name field &
154 | Trap non-updatable Master/Detail fields
155 |
156 | 04/14/20 - Eric Smith - Version 1.1 -
157 | Enhancements: New Column Attribute to support column filtering
158 |
159 | 04/01/20 - Eric Smith - Version 1.0 -
160 | Features: The only required paramters are the SObject collection of records and a list of field API names
161 | The field label and field type will default to what is defined in the object
162 | Numeric fields will display with the correct number of decimal places as defined in the object
163 | Lookup fields are supported and will display the referenced record's name field as a clickable link
164 | All columns are sortable, including lookups (by name)
165 | The selection column can be multi-select (Checkboxes), single-select (Radio Buttons), or hidden
166 | A collection of pre-selected rows can be passed into the component
167 | Inline editing is supported with changed values passed back to the flow
168 | Unlike the original datatable component, only the edited records will be passed back to the flow
169 | The maximum number of rows to display can be set by the user
170 | Optional attribute overrides are supported and can be specified by list, column # or by field name, including:
171 |
172 | - Alignment
173 | - Editable
174 | - Header Icon
175 | - Header Label
176 | - Initial Column Width
177 | - Custom Cell Attributes including those with nested values {name: {name:value}}
178 | - Custom Type Attributes including those with nested values {name: {name:value}}
179 | - Other Custom Column Attributes including those with nested values {name: {name:value}}
180 |
181 | ---
182 |
183 | Copyright (c) 2020, Eric Smith
184 |
185 | Redistribution and use in source and binary forms, with or without modification, are permitted provided
186 | that the following conditions are met:
187 |
188 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
189 |
190 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
191 | in the documentation and/or other materials provided with the distribution.
192 |
193 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
194 | from this software without specific prior written permission.
195 |
196 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
197 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
198 | SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
199 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
200 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
201 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
202 |
--------------------------------------------------------------------------------
/force-app/main/default/classes/SObjectController2.cls:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * Based on a component (ItemsToApprove) created by: Alex Edelstein (Salesforce)
4 | * Based on a component (FlatTable) created by: J. Pipkin (OpFocus, Inc)
5 | *
6 | * Description: getColumnData
7 | * Get field information from a list of field names in order to build
8 | * the column definitions for the datatable
9 | *
10 | * getLookupData
11 | * For each lookup type field get the related object and "Name" field
12 | *
13 | * getRowData
14 | * Take a List of Records and a List of Lookup Field Names and
15 | * use the recordId values in the lookup fields get the values
16 | * of the Name fields in the corresponding records. Return the
17 | * records that now include both the Id and Name for each lookup.
18 | *
19 | * 10/xx/20 - Eric Smith - Version 2.46 Issue error if no field names are given
20 | * Allow case insensitive field names
21 | * Allow custom field API names w/o the __c suffix
22 | * Get and Return which fields are picklist fields along with Value & Label
23 | *
24 | * 09/22/20 - Eric Smith - Version 2.45 Set type as Richtext for Text Formula Fields
25 | *
26 | * 09/01/20 - Eric Smith - Version 2.43 Update Percent Field Handling and set Formula Fields to be Non-Editable
27 | *
28 | * 08/26/20 - Eric Smith - Version 2.42 Get and return User's Timezone Offset so Time fields can be adjusted
29 | *
30 | * 07/07/20 - Eric Smith - Version 2.37 Fixed date displaying as a day earlier
31 | *
32 | * 07/01/20 - Eric Smith - Version 2.36 Added a return value for the "Name" field of the SObject
33 | * This is used to display that field as a Link in the Datatable
34 | *
35 | * 06/19/20 - Eric Smith - Version 2.33 Fixed issue with lookup fields being blank in the first record
36 | * Renumbered to match datatableV2 versioning
37 | *
38 | * 06/03/20 - Eric Smith - Version 2.0 Renamed to allow for easier installation with datatableV2
39 | *
40 | * 04/28/20 - Eric Smith - Version 1.2 Handle lookup Objects without a Name field &
41 | * Trap non-updatable Master/Detail fields
42 | *
43 | * 04/14/20 - Eric Smith - Version 1.1 Cleaned up some error handling
44 | *
45 | * 04/01/20 - Eric Smith - Version 1.0
46 | *
47 | **/
48 |
49 | public with sharing class SObjectController2 {
50 |
51 | // this is just a convenient way to return multiple unique pieces of data to the component
52 | public class ReturnResults {
53 | List