I am currently encountering a similar challenge. I am building a custom Lightning Web Component (LWC) to replicate standard Salesforce List View functionality, which will allow users without administrative access to create and manage their own list views. I am utilizing Named Credentials to handle the creation and updating of these list views.
However, I am running into a few issues:
First, I am unable to retrieve only the fields that are eligible for List View creation. When I fetch the fields for the User object, the system returns every field on the object. I have realized that not all of these fields are actually available or supported for use inside a standard List View.
Second, when attempting to save the list view via the Metadata API, the standard SOQL field API names fail. When I fetch an existing list view to inspect it, the XML returns completely different internal API names, as shown in the snippet below:
<ListView xmlns="
http://soap.sforce.com/2006/04/metadata
">
<fullName>testing_list_view_2</fullName>
<columns>CORE.USERS.FAX</columns>
<columns>CORE.USERS.FIRST_NAME</columns>
<columns>FULL_NAME</columns>
<columns>DVC_Is_Manually_Cleared__c</columns>
<columns>CORE.USERS.LAST_LOGIN</columns>
<columns>CORE.USERS.LAST_NAME</columns>
<columns>CORE.USERS.MIDDLE_NAME</columns>
<columns>CORE.USERS.CELL</columns>
<columns>CORE.USERS.COMMUNITY_NICKNAME</columns>
<columns>OOO_End_Date__c</columns>
<columns>OOO_Start_Date_Time__c</columns>
<columns>CORE.USERS.PHONE</columns>
<columns>Planned_Activation_Date__c</columns>
<columns>CORE.USERS.STATE_CODE</columns>
<columns>CORE.USERS.SUFFIX</columns>
<filterScope>Everything</filterScope>
<label>testing list view 2</label>
<sharedTo>
<allInternalUsers></allInternalUsers>
</sharedTo>
</ListView>
Based on this, I have two questions:
- Is there a programmatic way to retrieve only the specific fields that are available for selection when creating a User List View in the standard Salesforce UI?
- Is there an official documentation page or mapping matrix I can refer to that translates standard SOQL field API names to these specific Metadata API names?
Hi @Manav joshi
I agree with suggestions provided by Danish.
Two other things worth considering before building and maintaining that mapping:
- Check whether you need a custom LWC at all. Users without admin access can already create their own private list views if they have the āCreate and Customize List Viewsā permission.
- If you do need the LWC, look at the UI API list view resources instead of the Metadata API. They work with normal field API names, so the CORE.USERS.* mapping problem goes away.