I am trying to get the count of all the components available in the org using Metadata API. But when I try to get the count of flows, it gives me the total count of visual flow plus process builder. I came across this document and I think I need to specify processType
to differentiate between the flows. I am having issue trying to figure out how to use this in my code. Any idea or help please let me know. Below is my method
public Integer getSizeofComponents(String metaType){
MetadataService.MetadataPort service = new MetadataService.MetadataPort();
service.SessionHeader = new MetadataService.SessionHeader_element();
service.SessionHeader.sessionId = UserInfo.getSessionId();
List<MetadataService.ListMetadataQuery> queries = new List<MetadataService.ListMetadataQuery>();
MetadataService.ListMetadataQuery queryLayout =new MetadataService.ListMetadataQuery();
queryLayout.folder = '';
queryLayout.type_x = metaType;
queries.add(queryLayout);
if(metaType == 'flow')
system.debug('metaType ----------->> ' + metaType);
MetadataService.FileProperties[] fileProperties = service.listMetadata(queries, 40);
if(metaType == 'flow')
system.debug('fileProperties ----------->> ' + fileProperties);
if(fileProperties != null){
return fileProperties.size();
}else{
return 0;
}
}