1

I am trying to display standard list view of any custom object inside a lightning component (to be used in Community Builder - and if possible in SF1).

Now, I already checked some events like e.force:navigateToList, but it redirects the complete browser location to the new list view page.

Is there a way to have standard list view and some other custom components in a single component so that complete browser page is not getting redirected but rather just the component portion will load the list view.

I used this - https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/ref_force_navigateToList.htm

1 Answer 1

1

You can use Salesforce REST API to fetch the List View options related to any custom object and then after parsing the response you can display the options in the HTML select tag.

You have to use the 2 HTPPCallout to implement this approach.

  1. To get the list view options, and
  2. To get the SOQL query related to selected list view options.

You can refer the following sample code:

  • To get fetch the list view options
Http http = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint(System.Url.getSalesforceBaseUrl().toExternalForm() + '/services/data/v32.0/sobjects/Account/listviews');
req.setHeader('Authorization','Bearer ' + UserInfo.getSessionId());
req.setMethod('GET');
HttpResponse resp = http.send(req);
System.debug('Response Body : ' + resp.getBody());
  • To fetch SOQL related to selected List View options:
Http http = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint(System.Url.getSalesforceBaseUrl().toExternalForm() + '/services/data/v32.0/sobjects/Account/listviews/001b0000004EGRrEAO/describe');
req.setHeader('Authorization','Bearer ' + UserInfo.getSessionId());
req.setMethod('GET');
HttpResponse resp = http.send(req);
System.debug('Response Body : ' + resp.getBody());

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .