ListViewHelper
getListViewObjects()
Parameters None
Response Map<String, String> - a map with the retrieved object names. Key = API name, Value = label
- An aggregated list of objects that have both standard and custom list views are returned.
- The logic uses the SLV list view data. Refresh the SLV list view data if unexpected results are returned
- This method does not use the cache but always returns a fresh compiled list of objects.
Example
Map<String, String> objs = simpli_lv_ent.ListViewHelper.getListViewObjects();
for (String key: objs.keySet())
System.debug(key + ', ' + objs.get(key));
getObjectListViews(String objectName)
Parameters objectName - the API name of the object that will have its list views returned.
Response Map<String, simpli_lv__List_View__c> - a map with the retrieved list views. Key = list view API name, Value = list view object
- Both standard and custom list views for the provided object is returned.
- The following logic is used to determine if the list view should be returned to the currently running user
- If user is sys admin
- If user is owner
- If list view has role requirement and user is in role
- If user is in allowed groups
- If user is in allowed territories
- Otherwise do not return list view
- This method uses the cache if available. The list views list is stored in cache per user.
Examples
Map<String, simpli_lv__List_View__c> listviews = simpli_lv_ent.ListViewHelper.getObjectListView(String objectName);
for (String key: listviews.keySet())
System.debug(key + ', ' + listviews.get(key));
refreshSingleListView(String objectName, String listViewName)
Parameters objectName - the API name of the object that will have its list views refreshed.
listViewName - the API name of the list view that will be refreshed.
Response String - "success" indicating the result of the refresh request.
- The standard list view for the provided object name and list view name is refreshed.
- An object API name must be provided.
- A listview API name must be provided.
- This method is synchronous. The list view is updated immediately.
- If the method fails a simpli_lv.ListViewException is thrown with the message indicating the issue.
- The SLV config cache for the running user is cleared.
Examples
String objectName = 'Account';
String listViewName = 'AllAccounts';
simpli_lv_ent.ListViewHelper.refreshSingleListView(objectName, listViewName);
refreshObjectListViews(String objectName)
Parameters objectName - the API name of the object that will have its list views refreshed.
Response String - "success" indicating the result of the refresh request.
- All standard list views for the provided object name are refreshed.
- An object API name must be provided.
- This method is synchronous. List views are updated immediately.
- If the method fails a simpli_lv.ListViewException is thrown with the message indicating the issue.
- The SLV config cache for the running user is cleared.
Examples
String objectName = 'Account';
simpli_lv_ent.ListViewHelper.refreshObjectListViews(objectName);
refreshAllListViews()
Parameters None
Response String - the batch job Id of the list view refresh batch job.
- All standard list views are refreshed.
- This method is asynchronous. The list views are processed as a batch job.
- The returned job id can be used to keep track of the status of the batch job.
- If the method fails a simpli_lv.ListViewException is thrown with the message indicating the issue.
- The SLV config cache for the running user is cleared.
Examples
String jobId = simpli_lv_ent.ListViewHelper.refreshAllListViews();
ApexJob job = [[SELECT Status, NumberOfErrors, JobItemsProcessed, ApexClass.Name FROM AsyncApexJob WHERE Id = :jobId];
refreshChangedListViews()
Parameters None
Response String - "success" indicating the result of the refresh request.
- The last changed standard list view by the running user is refreshed.
- This method is synchronous. The list view is updated immediately.
- If the method fails a simpli_lv.ListViewException is thrown with the message indicating the issue.
- The SLV config cache for the running user is cleared.
Examples
simpli_lv_ent.ListViewHelper.refreshChangedListViews();
exportJSON()
Parameters None
Response String - a JSON string containing all custom list views, list view configs for the
returned list views and all list view actions.
- Method to export all custom list views, configuration and actions to a JSON string.
- Currently no standard list views are exported. This may change in future releases.
- For more advanced filtering on entities that are exported use the below methods.
- The JSON string is compatible with the importJSON() method and can be used directly.
Examples
String jsonStr = simpli_lv_ent.ListViewHelper.exportJSON();
System.debug(jsonStr);
importJSON(String importJSON)
Parameters importJSON - the JSON string containing the entities to be imported.
Response String - a colon and semi-colon delimited string holding the success for each
entity imported. See notes.
- Method to import all custom list views, configurations and actions from a provided JSON string.
- The input JSON string can be created using the exportJSON() method and can be used directly.
Examples
String jsonStr = simpli_lv_ent.ListViewHelper.exportJSON();
String result = simpli_lv_ent.ListViewHelper.importJSON(jsonStr);
System.debug(result);
//Example output : List Views:12:2;Configs:12:2;Actions:7:0;
//Above example output indicates the following -
// 12 list views successfully added, 2 failed with errors
// 12 list view configs successfully added, 2 failed with errors
// 7 actions successfully added, 0 failed
getListViewQuery(String objectName, String listViewName)
Parameters objectName - the API name of the object that the list view is created for.
listViewName - the API name of the list view that the query will be pulled from.
Response String - the SOQL query for the given object and list view.
- This method pulls the base SOQL query for a given list view.
- The method works for both standard and custom list views.
- For more advanced queries which include offsets, sorting, joining and text search use the more advanced methods.
Examples
String objectName = 'Account';
String listViewName = 'AllAccounts';
String query = simpli_lv_ent.ListViewHelper.getListViewQuery(objectName, listViewName);
System.debug('The query - ' + query);
//Example output : The query - SELECT NAME, SITE, BILLINGSTATE, PHONE, TOLABEL(TYPE), OWNER.ALIAS, ID, CREATEDDATE, LASTMODIFIEDDATE, SYSTEMMODSTAMP, OWNER.ID, OWNERID, ISDELETED FROM ACCOUNT USING SCOPE Everything ORDER BY Name ASC NULLS LAST, Id ASC NULLS LAST LIMIT 100
getListViewColumns(String objectName, String listViewName)
Parameters objectName - the API name of the object that the list view is created for.
listViewName - the API name of the list view that the columns data will be pulled from.
Response List<Map<String, String>> - the column data for the given object and list view.
- Method that returns column information for the provided object and list view.
- The method works for both standard and custom list views.
Examples
String objectName = 'Account';
String listViewName = 'AllAccounts';
List<Map<String, String>> columns = simpli_lv_ent.ListViewHelper.getListViewColumns(objectName, listViewName); System.debug(JSON.serialize(query));
//Example output :
[
{
"type": "string",
"columnWidth": null,
"name": "Name",
"label": "Account Name"
},
{
"type": "phone",
"columnWidth": null,
"name": "Phone",
"label": "Account Phone"
},
{
"type": "picklist",
"columnWidth": null,
"name": "Type",
"label": "Account Type"
},
{
"type": "string",
"columnWidth": null,
"name": "Owner.Alias",
"label": "Alias"
}
]
clearCache()
Parameters None
Response None
- Clears all cache for the entire Simpli List Views app.
Examples
simpli_lv_ent.ListViewHelper.clearCache());
ListViewConfigHelper
updateOrgWideParam(String paramName, String value)
Parameters paramName - the API name of the setting to be updated.
value - the value the setting should be set to. Note the value must be a string.
Response None
- The setting API names can be found at HQ -> Documentation ->
Examples
simpli_lv_ent.ListViewConfigHelper.updateOrgWideParam('Debug', 'true');
//the example above turns on debugging
updateOrgWideParams(Map<String, String> newParams)
Parameters newParams - a map containing the API name and value pairs of the settings to
be updated.
Response None
- The setting API names can be found at HQ -> Documentation ->
Examples
Map<String, String> params = new Map<String, String>();
params.put('Debug', 'true');
params.put('AllowAdmin', 'false');
simpli_lv_ent.ListViewConfigHelper.updateOrgWideParams(params);
//the example above turns on debugging and stops the admin cog icon from being available to users
getOrgWideParam(String paramName)
Parameters paramName - the API name of the setting to be retrieved.
Response String - the value of the setting
- The setting API names can be found at HQ -> Documentation ->
Examples
String setting = simpli_lv_ent.ListViewConfigHelper.getOrgWideParam('Debug');
System.debug('The setting is - ' + setting);
//the example above gets the debug setting value
getOrgWideParams()
Parameters None
Response Map<String, String> - a map containing the API name and value pairs of all org
wide settings.Notes
- The setting API names can be found at HQ -> Documentation ->
Examples
Map<String, String> params = simpli_lv_ent.ListViewConfigHelper.getOrgWideParams();
//this example gets all org wide params
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article