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/v42.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/v42.0/ui-api/list-ui/Account/AllAccountsThe request returns a list of records and the metadata for the list view.
1{ 2 "eTag" : "ca78063dc5bd0fe520d5a6f88d9cd579", 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" : "BillingState", 13 "label" : "Billing State/Province", 14 "sortable" : true 15 }, { 16 "fieldApiName" : "Phone", 17 "label" : "Phone", 18 "sortable" : true 19 }, { 20 "fieldApiName" : "Type", 21 "label" : "Type", 22 "sortable" : true 23 }, { 24 "fieldApiName" : "Owner.Alias", 25 "label" : "Account Owner Alias", 26 "sortable" : true 27 } ], 28 "eTag" : "86d3a33eddb41d9889b38b102c915abf", 29 "filterLogicString" : null, 30 "filteredByInfo" : [ ], 31 "id" : { 32 "id" : "00BR0000000Wc0rMAC", 33 "objectApiName" : "Account", 34 "type" : "listView" 35 }, 36 "label" : "All Accounts", 37 "listViewApiName" : "AllAccounts", 38 "orderedByInfo" : [ { 39 "fieldApiName" : "Name", 40 "isAscending" : true, 41 "label" : "Account Name" 42 } ], 43 "updateable" : true, 44 "userPreferences" : { 45 "columnWidths" : { 46 "Type" : -1, 47 "Owner.Alias" : -1, 48 "Phone" : -1, 49 "BillingState" : -1, 50 "Name" : -1 51 }, 52 "columnWrap" : { 53 "Type" : false, 54 "Owner.Alias" : false, 55 "Phone" : false, 56 "BillingState" : false, 57 "Name" : false 58 } 59 }, 60 "visibility" : "Public", 61 "visibilityEditable" : true 62 }, 63 "records" : { 64 "listInfoETag" : "86d3a33eddb41d9889b38b102c915abf", 65 "records" : { 66 "count" : 3, 67 "currentPageUrl" : "/services/data/v42.0/ui-api/list-records/00BR0000000Wc0rMAC?pageSize=50&pageToken=0", 68 "nextPageUrl" : null, 69 "previousPageUrl" : null, 70 "records" : [ { 71 "apiName" : "Account", 72 "childRelationships" : { }, 73 "eTag" : "d2ac6442449f4818a11b6ea6bc09b39a", 74 "fields" : { 75 "BillingState" : { 76 "displayValue" : null, 77 "value" : "NY" 78 }, 79 "CreatedDate" : { 80 "displayValue" : null, 81 "value" : "2017-11-01T19:10:42.000Z" 82 }, 83 "Id" : { 84 "displayValue" : null, 85 "value" : "001R0000003IXwiIAG" 86 }, 87 "LastModifiedDate" : { 88 "displayValue" : null, 89 "value" : "2017-11-01T19:10:42.000Z" 90 }, 91 "Name" : { 92 "displayValue" : null, 93 "value" : "Acme" 94 }, 95 "Owner" : { 96 "displayValue" : null, 97 "value" : { 98 "apiName" : "User", 99 "childRelationships" : { }, 100 "eTag" : "80236fa1232c205cbfdd1c2f53b1d6b6", 101 "fields" : { 102 "Alias" : { 103 "displayValue" : null, 104 "value" : "AUser" 105 }, 106 "Id" : { 107 "displayValue" : null, 108 "value" : "005R0000000ITVpIAO" 109 } 110 }, 111 "id" : "005R0000000ITVpIAO", 112 "recordTypeInfo" : null 113 } 114 }, 115 "OwnerId" : { 116 "displayValue" : null, 117 "value" : "005R0000000ITVpIAO" 118 }, 119 "Phone" : { 120 "displayValue" : null, 121 "value" : "(212) 555-5555" 122 }, 123 "SystemModstamp" : { 124 "displayValue" : null, 125 "value" : "2017-11-01T19:10:42.000Z" 126 }, 127 "Type" : { 128 "displayValue" : "Prospect", 129 "value" : "Prospect" 130 } 131 }, 132 "id" : "001R0000003IXwiIAG", 133 "recordTypeInfo" : null 134 } 135 ... Additional records removed for brevity ... 136 ] 137 } 138 } 139} - 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/v42.0/ui-api/list-ui/00BR0000000Wc0rMAC?sortBy=CreatedDate