Newer Version Available
Work with List Views
Use the List View resources to get record data and metadata about
list views displayed in the Salesforce UI.
- Get Record Data and Metadata for a List View
-
As an example, let’s say we have a list view named All Accounts with a list view ID of 00BR0000000Wc0rMAC. To get information about all the records and metadata for this list view, make this request.
1/services/data/v47.0/ui-api/list-ui/00BR0000000Wc0rMACYou can also use the object API name and list view API name of the list view to make the same request.
1/services/data/v47.0/ui-api/list-ui/Account/AllAccountsThe request returns a list of records and the metadata for the list view.
1{ 2 "eTag" : "6fea2ca99f3740c72f1667ee522980a7", 3 "info" : { 4 "cloneable" : true, 5 "createable" : true, 6 "deletable" : true, 7 "displayColumns" : [ { 8 "fieldApiName" : "Name", 9 "label" : "Account Name", 10 "sortable" : true 11 }, { 12 "fieldApiName" : "Site", 13 "label" : "Account Site", 14 "sortable" : true 15 }, { 16 "fieldApiName" : "BillingState", 17 "label" : "Billing State/Province", 18 "sortable" : true 19 }, { 20 "fieldApiName" : "Phone", 21 "label" : "Phone", 22 "sortable" : true 23 }, { 24 "fieldApiName" : "Type", 25 "label" : "Type", 26 "sortable" : true 27 }, { 28 "fieldApiName" : "Owner.Alias", 29 "label" : "Account Owner Alias", 30 "sortable" : true 31 } ], 32 "eTag" : "f5f522aef88a0cb38be54b9c0095fe3c", 33 "filterLogicString" : null, 34 "filteredByInfo" : [ ], 35 "label" : "All Accounts", 36 "listReference" : { 37 "id" : "00BRM000002KPM42AO", 38 "listViewApiName" : "AllAccounts", 39 "objectApiName" : "Account", 40 "type" : "listView" 41 }, 42 "orderedByInfo" : [ { 43 "fieldApiName" : "Name", 44 "isAscending" : true, 45 "label" : "Account Name" 46 } ], 47 "updateable" : true, 48 "userPreferences" : { 49 "columnWidths" : { 50 "Site" : -1, 51 "Type" : -1, 52 "Owner.Alias" : -1, 53 "Phone" : -1, 54 "BillingState" : -1, 55 "Name" : -1 56 }, 57 "columnWrap" : { 58 "Site" : false, 59 "Type" : false, 60 "Owner.Alias" : false, 61 "Phone" : false, 62 "BillingState" : false, 63 "Name" : false 64 } 65 }, 66 "visibility" : "Public", 67 "visibilityEditable" : true 68 }, 69 "records" : { 70 "count" : 12, 71 "currentPageToken" : "0", 72 "currentPageUrl" : "/services/data/v43.0/ui-api/list-records/Account/AllAccounts?pageSize=50&pageToken=0", 73 "listInfoETag" : "f5f522aef88a0cb38be54b9c0095fe3c", 74 "nextPageToken" : null, 75 "nextPageUrl" : null, 76 "previousPageToken" : null, 77 "previousPageUrl" : null, 78 "records" : [ { 79 "apiName" : "Account", 80 "childRelationships" : { }, 81 "eTag" : "d55bcd780f2145b724be5a563f37b9b2", 82 "fields" : { 83 "BillingState" : { 84 "displayValue" : null, 85 "value" : "NC" 86 }, 87 "CreatedDate" : { 88 "displayValue" : null, 89 "value" : "2018-04-11T00:37:56.000Z" 90 }, 91 "Id" : { 92 "displayValue" : null, 93 "value" : "001RM000003UNtxYAG" 94 }, 95 "LastModifiedDate" : { 96 "displayValue" : null, 97 "value" : "2018-04-11T00:37:56.000Z" 98 }, 99 "Name" : { 100 "displayValue" : null, 101 "value" : "Burlington Textiles Corp of America" 102 }, 103 "Owner" : { 104 "displayValue" : null, 105 "value" : { 106 "apiName" : "User", 107 "childRelationships" : { }, 108 "eTag" : "671bc4877d13cd4f43d28a671636f873", 109 "fields" : { 110 "Alias" : { 111 "displayValue" : null, 112 "value" : "AUser" 113 }, 114 "Id" : { 115 "displayValue" : null, 116 "value" : "005RM000001cNuJYAU" 117 } 118 }, 119 "id" : "005RM000001cNuJYAU", 120 "recordTypeInfo" : null 121 } 122 }, 123 "OwnerId" : { 124 "displayValue" : null, 125 "value" : "005RM000001cNuJYAU" 126 }, 127 "Phone" : { 128 "displayValue" : null, 129 "value" : "(336) 222-7000" 130 }, 131 "Site" : { 132 "displayValue" : null, 133 "value" : null 134 }, 135 "SystemModstamp" : { 136 "displayValue" : null, 137 "value" : "2018-04-11T00:37:56.000Z" 138 }, 139 "Type" : { 140 "displayValue" : "Customer - Direct", 141 "value" : "Customer - Direct" 142 } 143 }, 144 "id" : "001RM000003UNtxYAG", 145 "recordTypeInfo" : null 146 }, { 147 ... Additional records removed for brevity ... 148 ] 149 } 150 } 151} - Modify the List View Results
-
To modify the results returned by the List View resources, use the following request parameters:
- fields—Additional fields queried for the records returned, for display purposes. If a field is specified and the user doesn’t have access to it, an error occurs.
- optionalFields—Additional fields queried for the records returned, for display purposes. If a field is specified and the user doesn’t have access to it, no error occurs.
- pageSize—The number of list records viewed at one time.
- pageToken—A token that represents the page offset.
- sortBy—The API name of the field the list view is sorted by.
For example, to sort records by the date they were created, set the sortBy parameter to CreatedDate.
1GET /services/data/v47.0/ui-api/list-ui/00BR0000000Wc0rMAC?sortBy=CreatedDate