5

Use case: Cloning ListViews in Apex using the Apex Metadata API wrapper

I created a simple code snippet:

MetadataService.MetadataPort service =  MetadataServiceExamples.createService();
MetadataService.ListView[] cloneListViews   = new List<MetadataService.ListView>();
MetadataService.ListView cloneListView = new MetadataService.ListView();    
// populate the fields in cloneListView including field fullName by copying from some retrieved ListViews
cloneListViews.add(cloneListView);
MetadataService.SaveResult[] results = 
      service.createMetadata(new List<MetadataService.ListView> ( cloneListViews )); 

Yet results shows a failure with this message:

fullname=User00_Opptys_Closing_This_Month
Message:Need to specify full name, Name:User00_Opptys_Closing_This_Month, Delimiter:. 
        statusCode: FIELD_INTEGRITY_EXCEPTION

2 Answers 2

7

This is basically a face plant but since it took me an hour to figure this out I thought I would save someone else the time

  • ListViews are associated with objects and as such, the metadata's fullname has to be the ObjectApiName.ListViewApiName. If using namespaces, then Namespace__.ObjectApiName.ListViewApiName
  • Simply making fullname='User00_Opptys_Closing_This_Month' is not enough, it needs to be 'Opportunity.User00_Opptys_Closing_This_Month'
  • The error message hints at this problem by including the Delimiter:. in the message
  • There is a reason the metadata field is called fullname but if you only sporadically use the Metadata API then this is easy to get confused with the API name for the ListView such as you see in the Force.com point-and-click UI, i.e. User00_Opptys_Closing_This_Month.
  • The documentation in the MetaData API on fullName only mentions that the objectAPIName is required for fields, not ListViews (I filed doc feedback on this point).
0

I had a similar error when migrating process builder Flow with Metadata API. The solution was to specify the flow version like MyFlow-1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.