function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Dave The RaveDave The Rave 

add field to multiple listviews on one object

Hi Salesforce developers,

As an admistrator, I need to add one new custom field to all listviews e.g. sharedvendor__c from the case object. There are over 50 different list views.

How can I do this in the most efficient way? I think this might require a DML statement or apex class, but cannot find the answer in any forum.

Can you help?

Dave



 
VinayVinay (Salesforce Developers) 
Hi Dave,

This is not feasible via UI.  You can check ListView metadata and use columns attribute in below article link.

https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_listview.htm

You can edit more records at once:
https://releasenotes.docs.salesforce.com/en-us/winter18/release-notes/rn_sales_productivity_list_views_mass_inline_edit.htm

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,
Vinay Kumar
Dave The RaveDave The Rave
Hi Vinay, I had a look at the link. So, I need to change the metadata from the listview object. How do I do that? I see that somehow I need to add a field value to the column field which is a list of strings.

As an adminstrator, I now how to add apex code in the developer console, but do not know how to write it.

Thanks,

Dave