0

I am using MetadataApi, to get listview Metadata via Apex. if i logged in as System administrator it's working fine and get the data, but when i call same Apex Method from Community as Community user i got exception.

IO Exception: Unauthorized endpoint, please check Setup->Security->Remote site settings. endpoint = https://XXXXXX/Soap/m/46.0

i found this accessing-metadata-api-in-communities after a deep hunt in our forum

but that one is 2 years back solution, so i am still searching is there any new features came up after 2017 to access the MetadataApi as Community user.

use case

i need add limit to show the no of records for my listviews in community, unfortunately with full layout option in record list component doesn't support the no of records limit to show, enter image description here

so this lack of feature made me to develop a custom lightning component and i used lightning:listview and then by apex SOQL i pulled list view developer Names for my sobject and then bind to lightning:select based on select option i loading the lightning:listview dynamically up to here every thing works fine.

but some of listviews are using sharing settings like visible to certain groups option. but my get listview developer name SOQL query returns all listviews developer names, some of them doesn't have access for logged in user.

so above lack of feature made me to use MetadataApi to get the listview sharing setting Metatadata and then Check Access level of listview. but after all community user is not able to access metatadata API.

is there any other work around for my use case.

3
  • you might try David Reed's suggestion of using a callout w/ Named Credential (with predefined sysad creds) to an apex REST class that in turn does the metadata API callout and returns results back
    – cropredy
    Aug 2, 2019 at 22:05
  • @cropredy can you please more elaborate your/david reed suggestion, or provide david suggestion link
    – sdandamud1
    Aug 2, 2019 at 23:22
  • Search for how to run as a different user. I don't have time right now to find it.
    – cropredy
    Aug 2, 2019 at 23:46

1 Answer 1

1

How about using UI Api to get listViews?

/services/data/v46.0/ui-api/list-records/Account/AllAccounts

https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_list_views_md.htm?search_text=list%20view

1
  • thanks pranay, but i need to access the Sharedto metadata from Listview Metadata. to check logged in user had access for that list view or not? ` UI Api` doesn't give SharedTo settings for Listview. let me update my question with exact Use case
    – sdandamud1
    Aug 2, 2019 at 15:22

You must log in to answer this question.

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